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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add a Picture to an Access Database using DAO?

Status
Not open for further replies.

amarti44

Programmer
Feb 16, 2001
23
0
0
US
I'm writing a VB program that writes to an ACCESS database. This database has a picture field called "Picture" (an OLE Object). I'm using DAO to access that database. I open the database, the table, etc. But when I want to add a new record (including the picture) for example, the picture doesn't appear in a form that I created in the database, but the rest of the field are transfered without problems. I'm affraid that I'm not manipulating the picture field properly. I don't want to use the data control just DAO.This is the code. Can you help me? ...Thanks

Dim DB1 As Databse
Dim RS1 As Recordset
Dim WS1 As Workspace
Dim Database1_Path As String

Set WS1 = DBEngine.Workspaces(0)
Set DB1 = WS1.OpenDatabase(Database1_Path)
Set RS1 = DB1.OpenRecordset("Person", dbOpenTable)
RS1.AddNew
RS1("Last_name") = txtDataField(0).Text
RS1("First_name") = txtDataField(1).Text
RS1("Picture") = App.Path + "\visitpic.jpg"
RS1.Update
DB1.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top