biffaccess
05-14-2009, 03:45 AM
Hi
I have an application which the user customises reports with his own company name and logo by linking to the bmp on his PC/network. When he prints reports out the logo appears on each report sheet.
Unfortunately when this database is used offsite or sent to another office
the logo doesn't remain linked as the path is still set to the original
location.
Is there anyway that in the original setting up of the dbase info i can copy
the logo from its location and store it with the mdb so it becomes totally
portable and retains the feature.
Thanks for any help
brian
wiklendt
05-14-2009, 05:53 AM
what it looks like you need is relative referencing of the image. i'm not sure how to make it work over a true newtork, but it would be portable if kept locally (e.g., run off a USB stick, or off a single computer, or transfer between others). the idea is that you have all your images in a subfolder of the access file folder. then, when it's time to move the database, you take the whole project folder, not just the one access file.
now, that sounds simple, but making this relative linking of images user friendly is another thing.
what i do is this: have a table where the company has it's various info stored. in this table, add a field called soemthing like "CompanyLogo". in it we will store the image name, and make access find the current project path to refer to (that iwll make it easy for access to know the subfolder of the current project path).
i asume you have some way already of selecting the image, like a browse dialog. if not, i'll post what i use... i got it from a picture database sample file here in the forums... it's what got me started.
my setup is such:
code detects whether or not an image has already been assigned to that record. if not, it places a 'default' image in the image placeholder.
a browse button to find an image we want (this can replace an existing image).
behind-the-scenes code then copies that image from the original location to a subfolder of the current access file in use.
code also handles cancels - e.g., if a user opens the browse dialog but then changes their mind and clicks cancel, i've trapped that 'error' and user thinks nothing of it.
also, i have a 'remove' button, where code asks user whether they're sure they want to remove the image from the record, and also informs the user that the image is NOT deleted from the computer, just removed from the record itself. if the user says "yes", code deletes image info from table for that record. if user says "no", code reverts back to image that was there before the delete code was triggered.
what's more, is that this can be done for many images, not just a logo, so for example, an employee database with a picture for each employee.
i really should put this all into one sample file...
edit: here's the link to the thread that has the picture sample database (PictDatabase2000 by MStCry (http://www.access-programmers.co.uk/forums/showthread.php?t=108698)) i spoke of earlier. the one that started me off on my own elaborate setup. i mainly needed the sample for the module to trigger the open file browse dialog.
i'll work on my own as a stand-alone example and post it some time in the near future... i think it would help others, perhaps.