Image (Attachment) Display on Subform problem

GrandMasterTuck

In need of medication
Local time
Today, 12:04
Joined
May 4, 2013
Messages
129
Hi folks. I have two tables, tblAdmin (which contains my attachment field, a logo) and tblRecords (which contains customer records.

I created a form (frmMain) that displays customer records, and hooked frmMain to qrySelectCustomer, which is a query that... you guessed it!... selects a particular customer to view. I wanted the logo to appear at the top of this form, but it's in a separate table. I need to allow the database owner to go in and swap out one logo for another whenever he wants (if the business changes or whatever) and all my subsequent forms/reports have to pull this logo.

Here's the problem: I know I can't use any kind of DLookUp for the image/attachment, because DLookUp only fetches text not images, so what I did was create a subform called frmLogo and hooked the subform to tblAdmin where the attachment resides. It works perfectly when I just open the frmLogo, the image displays as it should. But when I open frmMain, I get a parameter value prompt because it can't find the image! Even though the subform frmLogo that's on frmMain is hooked to the correct frmAdmin table!

I tried several things, but the only thing that solved the problem was to ALSO hook frmMain to tblAdmin, which I do NOT want to do, because then I have to create a THIRD form for the customer data and hook THAT to qrySelectCustomer!

Is there any way around this that you guys know of? This is driving me crazy!
 
Last edited:
You may already do part of this, but this is how i handle logo's and other graphics that the user can/may change.

I have a parameters table and one of the entries will be for the logo file path.
In the Current event of any form/report that requires the logo i call a function to return the file path to the logo and then load the image using
Code:
Me![ImageFrame].Picture = GetLogo()
Code:
Function GetLogo() as string
GetLogo = Dlookup("[LogoPath]","[tblParameters]","[Parameter]='Logo'")
End Function

Give the users a settings option in a menu somewhere to be able to specify a new logo and store the file path in the parameters table.
 
Thanks, Isskint, that sounds like it would work for externally stored images, but my logo image is in the table itself, and not stored externally. I use Access' attachment dialogue to allow the user to attach an image to another form (frmSetup), and that attachment is stored in the table. I then have several forms and reports that display this image on them, and I want to be able to instantly update all of them by going back to that frmSetup form and double-clicking the attachment wherein the logo sits, selecting a different logo and clicking OK (all of this works perfectly EXCEPT for getting the dang logo to show up when it's on a subform who's parent form isn't linked to tblAdmin).

Unless I'm misunderstanding you... is there a 'file path' for an image stored in a table?
 
is it possible for you do upload your db.
 

Users who are viewing this thread

Back
Top Bottom