By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

Changing the background picture on a form with code

P: n/a
Hi there everyone,

I have a part info form which has a faded image of our company logo as a
background.
I want to replace the faded image with a bright red warning image on items
which have run out of purchasing cover.

I am nearly there, the only problem is that the code below only changes the
image background for text and combo-box backgrounds, it doesn't apply it to
the whole form.

This is the code I am using

If Me!GLTB = "Expired" Then
Me.Form.Picture = "P:\BAESRLREDDB.gif"
ElseIf Me!GLTB = "Valid" Then
Me.Form.Picture = "P:\BAESRLBLACKDB.gif"
end if

Another minor annoyance is that access flashes up an "importing picture"
window momentarilly.

Is there a way to avaoid this by assigning the pictures to variables in the
VB code or similar?

Any help greatly appreciated,

Thanks,

John
Nov 13 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"John Ortt" wrote
. . . replace the faded image with a bright
red warning image on items which have
run out of purchasing cover.

. . . problem . . . code below only changes
the image background for text and combo-
box backgrounds, it doesn't apply it to
the whole form.
If Me!GLTB = "Expired" Then
Me.Form.Picture = "P:\BAESRLREDDB.gif"
ElseIf Me!GLTB = "Valid" Then
Me.Form.Picture = "P:\BAESRLBLACKDB.gif"
end if


The only thing I can think of is that your pictures are not only not the
same size, but not the same height-width proportions. But, I don't
understand why you use "Me.Form.Picture" -- to check that I wasn't
misremembering this, I did something similar and used "Me.Picture".

Mine was slow, but I expected that, as I used jpg pictures that I happened
to have handy, which were not "small", and the PictureSizeMode property of
Zoom, so they not only had to be translated to device independent bitmaps,
but resized as well.

Because the picture and form did not have identical dimensions, my picture
filled the form from top-to-bottom, but not from side-to-side (that's the
way Zoom works). I resized the Form so the picture filled it, and when I
replaced the Picture property with the path-and-filename of an
identically-sized picture, it filled the entire form, too.

Unless there is some reason, I suggest you use Me.Picture instead of
Me.Form.Picture, and that you use your image processing software to resize
your image to the size of the form, reduce the resolution to screen
resolution (which you'll need to look up...VGA is 72 pixels per inch, and
SVGA is 96, as I recall, but newer computers have different ppi
requirements). And, I suspect there will be less "translation" to do if you
save it as a .BMP -- but I am not enough of an imaging expert to say that
for sure. Then do the same thing with your alternate image.

My guess is that the "shape" of your two images is not identical and that
the second one may just be filling the form in one direction, either
horizontal or vertical.

I do not have an answer for your question about the loading progress bar.
The approach I had in mind was using DoCmd.Echo False before setting the
picture property and DoCmd.Echo True afterwards, but the progress bar
appeared anyway.

Larry Linson
Microsoft Access MVP

Nov 13 '05 #2

P: n/a

"Larry Linson" <bo*****@localhost.not> wrote in message
news:au0xe.16193$gm6.14448@trnddc05...
The only thing I can think of is that your pictures are not only not the
same size, but not the same height-width proportions. But, I don't
understand why you use "Me.Form.Picture" -- to check that I wasn't
misremembering this, I did something similar and used "Me.Picture".

Mine was slow, but I expected that, as I used jpg pictures that I happened
to have handy, which were not "small", and the PictureSizeMode property of
Zoom, so they not only had to be translated to device independent bitmaps,
but resized as well.

Because the picture and form did not have identical dimensions, my picture
filled the form from top-to-bottom, but not from side-to-side (that's the
way Zoom works). I resized the Form so the picture filled it, and when I
replaced the Picture property with the path-and-filename of an
identically-sized picture, it filled the entire form, too.

Unless there is some reason, I suggest you use Me.Picture instead of
Me.Form.Picture, and that you use your image processing software to resize
your image to the size of the form, reduce the resolution to screen
resolution (which you'll need to look up...VGA is 72 pixels per inch, and
SVGA is 96, as I recall, but newer computers have different ppi
requirements). And, I suspect there will be less "translation" to do if you save it as a .BMP -- but I am not enough of an imaging expert to say that
for sure. Then do the same thing with your alternate image.

My guess is that the "shape" of your two images is not identical and that
the second one may just be filling the form in one direction, either
horizontal or vertical.

I do not have an answer for your question about the loading progress bar.
The approach I had in mind was using DoCmd.Echo False before setting the
picture property and DoCmd.Echo True afterwards, but the progress bar
appeared anyway.

Larry Linson
Microsoft Access MVP


Thanks for the reply Larry,

Unfortunately the two images are identical dimensions (I used the same image
but colourised and changed the hue to red).

The images are saved as .Gif's and are approximately 100 x 100 pixels. I
have them set to tile at the moment rather than zoom.

I did try the Me.Picture method prior to the Me.Form.Picture but the results
were exactly the same.

Since posting I have found a way round the issue of not refreshing the
background by momentarilly setting the tiling property to false and then
re-enabling it.

I did try Me.Refresh and Me.Repaint but these didn't do the trick....

I still want to find a way round the loading progress bar issue but it isn't
a big problem.

Thanks again for your suggestions,

John
Nov 13 '05 #3

P: n/a
This may not be a very satisfactory solution for you, but I shrunk some
sample databases _considerably_ by removing the "texture" (tiled) images
from the forms, and just using a color on the background. I'm reasonably
sure you'd get better performance that way, too. The samples I originally
create were too large for people using dial-up to download.

Larry Linson
Microsoft Access MVP

"John Ortt" <Jo******@Idontwantspamsonoreturnaddress.com> wrote in message
news:42**********@glkas0286.greenlnk.net...

"Larry Linson" <bo*****@localhost.not> wrote in message
news:au0xe.16193$gm6.14448@trnddc05...
The only thing I can think of is that your pictures are not only not the
same size, but not the same height-width proportions. But, I don't
understand why you use "Me.Form.Picture" -- to check that I wasn't
misremembering this, I did something similar and used "Me.Picture".

Mine was slow, but I expected that, as I used jpg pictures that I happened to have handy, which were not "small", and the PictureSizeMode property of Zoom, so they not only had to be translated to device independent bitmaps, but resized as well.

Because the picture and form did not have identical dimensions, my picture filled the form from top-to-bottom, but not from side-to-side (that's the way Zoom works). I resized the Form so the picture filled it, and when I
replaced the Picture property with the path-and-filename of an
identically-sized picture, it filled the entire form, too.

Unless there is some reason, I suggest you use Me.Picture instead of
Me.Form.Picture, and that you use your image processing software to resize your image to the size of the form, reduce the resolution to screen
resolution (which you'll need to look up...VGA is 72 pixels per inch, and SVGA is 96, as I recall, but newer computers have different ppi
requirements). And, I suspect there will be less "translation" to do if you
save it as a .BMP -- but I am not enough of an imaging expert to say that for sure. Then do the same thing with your alternate image.

My guess is that the "shape" of your two images is not identical and that the second one may just be filling the form in one direction, either
horizontal or vertical.

I do not have an answer for your question about the loading progress bar. The approach I had in mind was using DoCmd.Echo False before setting the
picture property and DoCmd.Echo True afterwards, but the progress bar
appeared anyway.

Larry Linson
Microsoft Access MVP


Thanks for the reply Larry,

Unfortunately the two images are identical dimensions (I used the same

image but colourised and changed the hue to red).

The images are saved as .Gif's and are approximately 100 x 100 pixels. I
have them set to tile at the moment rather than zoom.

I did try the Me.Picture method prior to the Me.Form.Picture but the results were exactly the same.

Since posting I have found a way round the issue of not refreshing the
background by momentarilly setting the tiling property to false and then
re-enabling it.

I did try Me.Refresh and Me.Repaint but these didn't do the trick....

I still want to find a way round the loading progress bar issue but it isn't a big problem.

Thanks again for your suggestions,

John

Nov 13 '05 #4

P: n/a
Thanks for the tip Larry,

I was worried about that and for that reason I linked to the images instead
of embedding them in the program.

Does it have an effect on file size even if you are only linking to the
image?

I have to confess I didn't check as I assumed it didn't.

"Larry Linson" <bo*****@localhost.not> wrote in message
news:jrjxe.5279$mr4.3355@trnddc05...
This may not be a very satisfactory solution for you, but I shrunk some
sample databases _considerably_ by removing the "texture" (tiled) images
from the forms, and just using a color on the background. I'm reasonably
sure you'd get better performance that way, too. The samples I originally
create were too large for people using dial-up to download.

Larry Linson
Microsoft Access MVP


Nov 13 '05 #5

P: n/a
I've done no work with linked pictures as form background, but linked images
as OLE objects did not reduce file size significantly, because Access and
the COM-enabled software that processes that type of image file still create
a _bitmap_ thumbnail that is far bigger than an original JPG or GIF at full
size and store it in the OLE object field.

Larry Linson
Microsoft Access MVP

"John Ortt" <Jo******@Idontwantspamsonoreturnaddress.com> wrote in message
news:42********@glkas0286.greenlnk.net...
Thanks for the tip Larry,

I was worried about that and for that reason I linked to the images
instead
of embedding them in the program.

Does it have an effect on file size even if you are only linking to the
image?

I have to confess I didn't check as I assumed it didn't.

"Larry Linson" <bo*****@localhost.not> wrote in message
news:jrjxe.5279$mr4.3355@trnddc05...
This may not be a very satisfactory solution for you, but I shrunk some
sample databases _considerably_ by removing the "texture" (tiled) images
from the forms, and just using a color on the background. I'm reasonably
sure you'd get better performance that way, too. The samples I originally
create were too large for people using dial-up to download.

Larry Linson
Microsoft Access MVP


Nov 13 '05 #6

P: n/a
Ahh, Ok.

Thanks Larry, might have to have a rethink on my design :)

"Larry Linson" <bo*****@localhost.not> wrote in message
news:nCoye.3068$kh3.1204@trnddc03...
I've done no work with linked pictures as form background, but linked images as OLE objects did not reduce file size significantly, because Access and
the COM-enabled software that processes that type of image file still create a _bitmap_ thumbnail that is far bigger than an original JPG or GIF at full size and store it in the OLE object field.

Larry Linson
Microsoft Access MVP

"John Ortt" <Jo******@Idontwantspamsonoreturnaddress.com> wrote in message
news:42********@glkas0286.greenlnk.net...
Thanks for the tip Larry,

I was worried about that and for that reason I linked to the images
instead
of embedding them in the program.

Does it have an effect on file size even if you are only linking to the
image?

I have to confess I didn't check as I assumed it didn't.

"Larry Linson" <bo*****@localhost.not> wrote in message
news:jrjxe.5279$mr4.3355@trnddc05...
This may not be a very satisfactory solution for you, but I shrunk some
sample databases _considerably_ by removing the "texture" (tiled) images from the forms, and just using a color on the background. I'm reasonably sure you'd get better performance that way, too. The samples I originally create were too large for people using dial-up to download.

Larry Linson
Microsoft Access MVP



Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.