
Linking or Embedding an OLE Object in an Access OLE DataType Field using DAO
Greetings all,
Would anyone know how I can write or embed or link or Bind an OLE object to
an Access Database field using DAO? I would like to save a photo along with
other employee
information to that database. Is this possible?
I have an application I have created in VB which saves various types of
information but when I try to save a photo, I run into a brick wall.
I have code below which finds and embeds the object(picture) to the OLE
Container.
CommonDialog1.Filter = "Pictures (*.bmp;*.ico)|*.bmp;*.ico"
CommonDialog1.ShowOpen
MyPictureLocation = CommonDialog1.filename
OLE1.CreateLink (MyPictureLocation)
How do I take that information and save it to an OLE DataType field in
Access using DAO? Below is code that writes the rest of the field to the
database.
On Error GoTo Errors
If rsMyData.RecordCount > 0 Then
rsMyData.MoveLast
End If
rsMyData.AddNew
rsMyData!LastName = txtEdit(0).Text
rsMyData!FirstName = txtEdit(1).Text
rsMyData!HomePhone = frmEdit.MaskEdBox1(0).Text
rsMyData!StreetAddress = txtEdit(3).Text
rsMyData!City = txtEdit(4).Text
rsMyData!State = txtEdit(5).Text
rsMyData!zip = MaskEdBox2.Text
rsMyData!EmployeeID = txtEdit(7).Text
rsMyData!SSNumber = MaskEdBox1(1).Text
'**************
If MyPictureLocation <> "" Then
'rsMyData!EmpPhoto = OLE1 '(This Does not work)
End If
'***************
rsMyData.Update
I would be happy for any suggestions on how this might be accomplished as I
seem to be running into brick walls with this one. This should be possible,
shouldn't it??
Thanks in advance,
William Oliveri