Adding an attachment in Access 2007 with code

K

KBDB

Hi,

I'm trying to add a record to my table that has an attachment via DAO.

I can't figure out my last step here.

Here is my code:

Private Sub SaveTheRecordClick()
Dim dbs As Database
Dim rst As DAO.Recordset
Dim rstComplex As DAO.Recordset2

Set rst = dbs.OpenRecordset("Current Issues", dbOpenDynaset)
Set rstComplex = Me.Recordset!Attach1.Value

rstComplex.FindFirst "FileName='" & Me.Attach_Label.FileName & "'"

With rst
On Error GoTo Errorhandle2
If rst.EOF Then
If rst.Updatable = True Then

rst.AddNew
rst!Title = Me.Title
rst!Attach1 = ????????????


Would you be so kind and help me out?
I would really appreciate it.

Thank you,

Kathleen
 
A

a a r o n _ k e m p f

DAO is depecrated, you should move to ADO if you want to do this.

I've written the IMAGE datatype into SQL Server hundreds of times
without any problems
and I've been doing it for a decade.

SQL Server 'just works'.

-Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Attachment 4
Invalid Use of Null 3
Make table from recordset 2
Adding records with VBA 2
Run Query on Subform Using VBA Macro Button 1
Importing Contacts From MS Outlook 1
Help with code 5
help with Code 1

Top