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

File Attachment in 2007

Status
Not open for further replies.

aperez54

Technical User
Aug 12, 2008
77
CA
This is driving me nuts.

I have a table with the following fields:

MainID --> numeric ID
FileAttachment --> attachment type field.

In a new form, all I want is to show the different attachments per record.

Right now, I only have 1 record that has 3 attachments. 2 command buttons to go previous and next.

previous works fine, but the forward doesn't!

sub cmdnext_click()
fileattachment.forward
end sub

I get an error that says Can't go to next record. The form is bound to the table, with fields:

fileattachment.filedata
fileattachment.filename
fileattachment.fietype

Any ideas?



 
No I didn't. I just dropped an attachment control on my form.
 
oh but the form itself is bound to the table. I did bind each control to the appropriate fields.
 
aperez54,

I tried creating a table and form like you described. I found that if you create a textbox with the control source set to "=[FileAttachment].[filedata]", then the form displays "#Name?" in that control. Controls with "=[FileAttachment].[filename]" or "=[FileAttachment].[filetype]" as the control source work fine. I also created "GoForward" and "GoBack" buttons, and they both worked, except that I found that I needed to add "[FileAttachment].Requery" to both of their OnClick events in order to update the filename and filetype controls. Here's my code:
Code:
Private Sub GoBack_Click()
    FileAttachment.Back
    [FileAttachment].Requery
End Sub

Private Sub GoForward_Click()
    FileAttachment.Forward
    [FileAttachment].Requery
End Sub
I hope this helps!
Lisa

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top