hi, im making a database for id cards, ive produced the OLE in the table and then in a form -screenshot- but at the moment to add a picture to the form i have to right click the image box, insert object, create from file, navigate to "F:\Project\PUPIL IMG\" and select the image. the image name will be the same name as the Pupil ID number.
i found this bit of code but have spent all day trying to get it to work i was wondering if anyone had any ideas.
thanks alot
i found this bit of code but have spent all day trying to get it to work i was wondering if anyone had any ideas.
Code:
Private Sub cmdOleAuto_Click()
On Error GoTo Error_cmdOleAuto_Click
With Me![OLEMempic]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLELinked
' Class statement--optional for Excel worksheet.
.Class = ".bmp"
' Specify the file to be linked.
' Type the correct path name.
'C:\Casey's Stuff\Photos\DB Photo Shots\ApprenticeNumber
.SourceDoc = "C:\\" & Me![UniqueNumber] & ".bmp"
' Range statement--optional for Excel worksheet.
.SourceItem = ""
' Create the linked object.
.Action = acOLECreateLink
' Optional size adjustment.
.SizeMode = acOLESizeStretch
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOleAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub
thanks alot