[AccessD] Replacing Graphics in Forms and Reports

Max Wanadoo max.wanadoo at gmail.com
Thu Aug 27 09:08:38 CDT 2009


I do that too Jim - now.  But over the 11 years of developing this stuff it
has grown and grown. Tons of it is never used and it could really do with a
prune.  Also, the FE & BE have moved around.
I was just doing a rebuild and re-importing stuff when it started
complaining it could  not find this graphic and that graphic and with
hundreds of forms and report I though, well I am not going to wade through
that lot.
Hence the code.  First run it through all the exceptions.  I then placed
them into the code and rerun until they were all done.

Then I shared.

Max

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hewson, Jim 
Sent: 27 August 2009 14:19
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Replacing Graphics in Forms and Reports

Max,
I'm a little confused as to why you would go to all this trouble?

What I do is design forms and reports with specific graphic dimensions. 
I store the images I need in an external path one level below the FE.
When the form/report is opened the code pulls in the image to display. I
can change the image at anytime... I just need to keep the name of the
image the same.  The graphic or picture does not have to be a specific
size either, the image object needs to be set to zoom and it will fit
within the confines object's dimensions.

I use a similar method to display pictures of personnel on forms and
reports.  On the form I have a text box that holds the name of the
picture (including the extension).  The picture is placed in the
directory and on after update the form refreshes and the picture
displays.  I have almost 500 personnel in the database and some have two
pictures.  I use a toggle button to display either picture. 

One line of code should suffice:

"\images\" is the subdirectory to the FE.
GraphicFile is the name with extension of the picture or graphic

ImageObjectName.Picture = Application.CurrentProject.Path &
"\images\GraphicFile.gif" 

This works in A2K, A2003 and A2007

HTH

Jim





More information about the AccessD mailing list