OLE Object acCmdInsertObject issue

bbagini

Registered User.
Local time
Yesterday, 16:44
Joined
Mar 8, 2012
Messages
10
Hi, I'm still quite new to vba and access and still learning my way around everything so take it easy if I'm missing something simple :o
I have a form, StaffAdmin and on this form I have a 4 fields and an OLE object, which has two copies. The first copy is a locked object which is there as the staff image, the second is only visible on new records for the purpose of attaching a new staff photo.

I want clicking on the second copy (visible only on new records) to open up the dialogue box and allow the user to attach the image
if I use:
Code:
Private Sub OLEBound60_Click()
 DoCmd.RunCommand acCmdInsertObject
 Me.Refresh
End Sub

When I go back into the form and click on the field, it opens up the insertObject dialogue box. However when I have selected the image and clicked ok, the image is saved and the staff image copy updates, however the dialogue box re-opens. I have spent a while searching through properties trying to figure out if its a simple little mistake due to a setting or if its something logically wrong.
I have tried removing the second copy of the OLE object ( the locked version being displayed) and that didn't help.

My third choice on how to try and fix it was run a command button with a focus of the object to open the insertObject dialogue box however I was getting a run-time 2110 error with this and I think it is a core thing I am missing due to inexperience.

Code:
Private Sub Command65_Click()
 Me.OLEBound60.SetFocus
 DoCmd.RunCommand acCmdInsertObject
End Sub

If I have missed out any information just let me know and I'll post what ever is needed
 
Last edited:

Users who are viewing this thread

Back
Top Bottom