Need help with attachment Control

sjslall

Registered User.
Local time
Yesterday, 21:31
Joined
Oct 21, 2010
Messages
34
I have an accdb file with a table that has an attachment field.
Each record has ONLY one attachment

I would like to use the attachment control to show the attachments from the table.

Form Layout
Attachment Control
2 Command Button (to keep showing the next and prev record attachment)

When the button is clicked the next or prev record should be displayed (attachment)

I checked the knowledbase, you need to assign the fieldname to controlsource.

Have checked that, but doesnot work....

Dim db as database
Dim rs as recordset
set db=currentdb()
set rs=db.openrecordset("select * from <table>")
attachment.controlsource=rs![<field>]

Pls assist

However when I use the new formwizard, the control accepts the click on the data bar created by the wizard.
I checked the controlsource of the attachment on the wizard drawn form, it shows as the fieldname.
 
If your form is bound to the table you need only set the control source to the field name.

Otherwise I think you need to assign the recordset to the form's Recordset property
Me.Recordset = rs

Then the ControlSource is set to a fieldname (as a string) in the recordset.
Me.[attachment].ControlSource = "fieldname"

It is good practice to fully define your recordset type as there is more than one type.
Dim rs As DAO.Recordset

Also I think attachment might be a reserved word so best avoided if this is the name you are using for your control rather than just as a dummy name here.
 

Users who are viewing this thread

Back
Top Bottom