Thanks a bunch JasperBond
Nice and simple!
Just gave you some kudos.
I'll give you more if you can solve this too:
I have a form, same as above, where I have two check boxes, that tell if a face and/or a full picture (standard named) is available for a person. If it is I try and show the picture in an unbound box, but I get two different errors, on different occasions.
Error #1
"Microsoft Visual Basic
Run-time error '2753'
A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control"
I keep getting this error, even when I click my command button, see code below.
Private Sub Form_Current()
UpdatePictures
End Sub
Public Sub UpdatePictures()
bitFullPicture_Name_Click
bitFacialPicture_Name_Click
End Sub
Private Sub bitFacialPicture_Name_Click()
If bitFacialPicture = True Then
oleFacialPicture.SourceDoc = "C:\Face\PopularName.jpg"
oleFacialPicture.Action = acOLECreateLink
Else
oleFacialPicture = Null
End If
End Sub
Private Sub bitFullPicture_Name_Click()
If bitFullPicture = True Then
oleFullPicture.SourceDoc = "C:\Full\PopularName.jpg"
oleFullPicture.Action = acOLECreateLink
Else
oleFullPicture = Null
End If
End Sub"
The variable "bitFacialPicture" and "bitFullPicture" is a Yes/No field/checkbox. The filename is actually generated from a name field on the form. When checked the picture is supposed to be shown and I use the "oleFacialPicture = Null" if it's not set, to erase the picture from the unbound field as it does not clear by it self.
Error #2 I'm getting, sometimes it works for a while and then if I click my above posted command button with code twice on the same record I get this error:
"Run-time error '2719':
A problem occured while accessing the OLE object"
Hope you or anyone else can help.
Thanks.