Importing a bitmap to an ole field
Hey,
I'm having trouble adding a bitmap file to an ole object field in my table.
Here's the problem....
I have a folder with a couple of hunderd bitmaps in them. What I need to do is to add these files into a table with their associated file name. I don't want to just link to files.
The table looks like
PhotoID (Autonumber, Primary Key)
PhotoName (String, The file name)
Photo (OLE Object, The actual photo)
I can loop through the files in the folder and get the PhotoName, no problem. But when I try to add the Photo to the ole field, it adds it in as "Long Binary Data", instead of a "Bitmap Image".
Does anyone know how to force the recordset into adding the data as a "Bitmap Image" (setting attributes somewhere??), or is there another way of doing this?
Here's a portion of the code I'm using:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim oFS As New FileSystemObject
Dim oFolder As Folder
Dim oFile As File
Set db = CurrentDb()
Set rs = db.OpenRecordset("IMAP_tblPhoto")
Set oFolder = oFS.GetFolder("C:\Photos")
With rs
For Each oFile In oFolder.Files
.AddNew
!PhotoName = oFile.Name
!Photo = oFile
.Update
Next oFile
End With
Thanks for any help!!
Cheers
Rohan
__________________
Cheers
Rohan
|