How add an attachment to a form and a report

I have a jpg file as an attachment in a table names tblDatabaseSetup and want to use it on a form and a report.  I don't know how to add it to the form and the report.  I've tried unbound object but that doesn't work or I don't understand how to use it.

--Steve
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Do you want to add an actual Attachment to the Form? If so, you can use the Attachment control to do this. You can drag/drop items into the control and it takes care of the rest for you.

If your query contains the Attachment field, your Access report can show that.
SteveL13Author Commented:
But the form is bound to a separate table.  I want the attachment that exists in a totally separate table to appear on the form/report.  The reason for this is that the user will want to change his logo file via the setup form I have created and then have it appear on a form/report.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
So you want to embed the image on the form? If so, then either (a) create a subform, and set that form's recordsource to the table holding your attachment or (b) don't use the Attachment datatype, and just store the image in a folder and use that in an Image control.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PatHartmanCommented:
I have an application that supports several subsidiaries for the parent company and each wants its own logo on certain reports.  The path is kept in the company table and that table is joined to the table used by the report.  This is the code that populates the logo on the report.  There is one trick however.  Access is smarter than all of us and so it takes it upon itself to rewrite your RecordSource query to eliminate any columns that are not bound to controls on the report.  So, in order for this to actually work, you need to create a hidden control bound to the logo path.  In my case it is called LogoPath (how creative).  When I put hidden controls on forms or  reports, I set their background to yellow to remind myself that they are not visible.
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
    If Me.LogoPath & "" = "" Then
    Else
        Me.imgLogo.Picture = Me.LogoPath
    End If
End Sub

Open in new window


I don't store the logos in the database because I could never figure out how to get this to work.  Only the path is stored.  All the logos are kept on the server in a folder below the one that holds the BE and other templates for certain Excel exports.
SteveL13Author Commented:
I used the sub-form method but am storing the other suggestion for future use.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.