insert OLE object with VB code

  • Thread starter Thread starter Chuck
  • Start date Start date
C

Chuck

I have a form with a bound object frame so that I can add an attachment to
my database. To add the attachment, I right-click the frame, select "Insert
Object", select "Create from file", and then select the "Browse" button.

I would like to add a button on the form that will do the "Insert Object"
action and bring up the "Browse" button in one step. I have not been able
to figure out the VB code required to do this.

Can anyone help?

Thanks

Chuck
 
One Way

Chuck,

One way to create your button is to use the following code in the "On Click" event of the button:


boundobjectcontrolname.SetFocus

DoCmd.RunCommand acCmdInsertObject


If you want to ALWAYS link the object (rather than embedding), change the "OLE Type Allowed" property of the Bound Object control to "Linked". This will disable and check the "linked" box in the "Insert Object" window. It will also only display the "Create From File" option in the window.


Brian
 
Back
Top