preventing the emedding of an ole object into a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bkberg05
    New Member
    • Aug 2009
    • 43

    preventing the emedding of an ole object into a form

    Hi - I have a form that has an OLE field on it. I've set the properties of the field to only allow links. So when you right click on the form and insert an object, that works great. But you can bypass this by opening up Explorer and dragging a file into the field, in which case it gets embedded rather than linked. Any way to prevent that from happening?

    Thanks in advance for the help.

    Bill
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by bkberg05
    Hi - I have a form that has an OLE field on it. I've set the properties of the field to only allow links. So when you right click on the form and insert an object, that works great. But you can bypass this by opening up Explorer and dragging a file into the field, in which case it gets embedded rather than linked. Any way to prevent that from happening?

    Thanks in advance for the help.

    Bill
    Have you set the OLE Type Allowed Property of the Object Frame to Linked?

    Comment

    • bkberg05
      New Member
      • Aug 2009
      • 43

      #3
      yes, I have. Which is why this seems so strange. Again, if you right click and add the file, it is automatically linked. But if you drag a file into the field on a form, it goes right in and is then embedded. I can tell it's embedded since I can delete the source file and it still appears. When you link a file and delete the source file, it can't locate the file.

      Comment

      • Megalog
        Recognized Expert Contributor
        • Sep 2007
        • 378

        #4
        Just a thought, since I dont work with OLE fields ever.. but maybe after that field is updated, you can test the data type in that record to see if it's a link or an object? If it doesnt pass the test, it clears it out and warns the user.

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by bkberg05
          yes, I have. Which is why this seems so strange. Again, if you right click and add the file, it is automatically linked. But if you drag a file into the field on a form, it goes right in and is then embedded. I can tell it's embedded since I can delete the source file and it still appears. When you link a file and delete the source file, it can't locate the file.
          My guess on this matter would be the following. The Object Frame containing an OLE Object does not recognize Drag and/or Drop Events, at least in VBA. Since it does not recognize a Drop Event, which contains a Source Argument, it cannot possibly identify the Absolute Path of the Source, which is needed for the Dynamic Linking of that Object. Assuming all this is even True, there is no other option other than to Ember the Object.

          Comment

          • bkberg05
            New Member
            • Aug 2009
            • 43

            #6
            I followed megalog's strategy and it worked great. Here's the snippet (without the warning).

            If Me![Order_Backup].OLEType = acOLEEmbedded Then
            [Order_Backup].Value = Null
            End If

            Comment

            • Megalog
              Recognized Expert Contributor
              • Sep 2007
              • 378

              #7
              Good job! I'm glad to see you ended up with a simple solution.

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #8
                Originally posted by Megalog
                Good job! I'm glad to see you ended up with a simple solution.
                Nice job Megalog, and to think that I was rambling on about Drag and Drop Events, Event Recognition, and other nonsense. Thank God I have a sensible individual to back me up! (LOL!).

                Comment

                Working...