Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting OLE object using code

Status
Not open for further replies.

NoelMG

Programmer
Dec 5, 2003
23
GB
Hi there

I'm trying to put some code behind a button to insert an ole object.

The field in my table is called ImageLocatin, and when I click the button I want it to look for the jpg in the location specified where the jpg is called forename surname.jpg, and insert it into the relevant field.

I have tried the following but it doesn't seem to recognise the Surname part!

Private Sub Command617_Click()
Dim rs As Recordset
rs.Open "tblpeople", CurrentProject.Connection, adOpenStatic, adLockOptimistic

Me.OLEDoc.SourceDoc = "R:\Images and Photos\" & "\" & rs!Forename & " " & rs!Surname & ".jpg"
Me.OLEDoc.OLETypeAllowed = acOLELink
Me.OLEDoc.Action = acOLECreateLink
End Sub

Am I doing something wrong here?

Thanks in advance,

Noel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top