HOW TO change form pic from code om MDE, in Runtime

T

Tony Vrolyk

In order to make my app a little prettier, I set the background pics on
several forms to some simple BMPs using the link property to avoid bloat.
However my app is distributed as an MDE under Access Runtime. I tried to
come up with a way to set this properties on all effected forms from code in
case the users installs to a differnt location then the default. Below is
what I tried but then the "duh" hit me and I realized it woudn't work in an
MDE. Does anyone have any other suggestions without using embedded images?

Thanks
Tony

'***Sample***
DoCmd.OpenForm "Customers", acDesign, , , , acHidden
Forms!Customers.Form.Picture = fCurrentDBDir & "bkgrnd.bmp"
DoCmd.Close acForm, "Customers", acSaveYes
 
B

Brendan Reynolds

I haven't tested this in an MDE or using the runtime, but I believe it
should work as it does not attempt to open the form in design view ...

Private Sub Form_Open(Cancel As Integer)

Me.PictureType = 1
Me.Picture = CurrentProject.Path & "\test.jpg"

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
T

Tony Vrolyk

I have already tried setting the pic OnOpen using a different method. The
problem is the slight fliker where the user first sees the plain gray
background and then the color background. It is slight, but on slower PCs
could be a distraction. I have tried opening the form visible = false, run
the code OnOpen and then set form visible = true but for some reason the
DoCmd.Maximize will not execute depending on where you put it, so I end up
having to add it before the pic code which causes the form to be visible and
still seeing the flicker.

Access depends on an external filter (like office picture viewer) to display
pictures. Since this is being distributed with Access Runtime, I can't be
sure that my users have the necessary filter so I use a module from Stephen
Lebans for displaying pics without depending on external filters. Not sure
if this is any slower than then the standard method but I have to use it.

Sounds like I am stuck with a solid color background.
 
B

Brendan Reynolds

Well, if it comes to a choice between a form with a pretty picture and a
form that opens quickly, I'll go with the form that opens quickly every
time! :)

With the possible exception of the first form that opens when the
application starts up, forms in business applications should, in my opinion,
be fairly bland. The user is not supposed to be sitting there admiring the
form, after all, they're supposed to be doing work! :) The form should not
distract the user's attention away from what really matters - the data.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
S

Stephen Lebans

There is no bloat when you embed Bitmaps within a standard Image
control. Here is a previous post of mine on this subject:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=uPLJKxYLEHA.3
348%40TK2MSFTNGP09.phx.gbl&rnum=1&prev=/groups%3Fnum%3D100%26hl%3Den%26l
r%3D%26ie%3DUTF-8%26scoring%3Dd%26q%3Dlebans%2B-ECKANKAR%2Bload%2Bimage%
2Bcontrol%2Bpicturedata

From: Stephen Lebans
([email protected])
Subject: Re: Efficient image use.


View this article only
Newsgroups: microsoft.public.access
Date: 2004-04-28 18:52:20 PST


Why Link them in the first place? Especially if you are using the Images
in more than one control!
The two methods I use are:

1) As explained in my previous post, with only a few images, simple
embed them directly within an Image control on a Form that you will keep
open during the entire session. Copy the PictureData prop from the
master Image control to whatver control you need to. The PictureData
prop is exposed for all controls that can contain an Image with the
exception of the OLE Framce controls.

2) If you want to completely hide the stored images from your users
then:
a) Open the form containing the controls that have the embedded
Images(Image, CommandButton etc.)
b) Copy the PictureData prop to a Long Binary Field
c) Now whenever you need the Image data simply copy it from the table
into the PictureData prop of the control.



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
T

Tony Vrolyk

Sorry I didn't reply sooner but thanks for the info. I have yet to read it
but it should help.

Regarding the look of a business app the Brenda referred to, this is a
different situation. It will be used by individuals who are running a home
based business. And the Business itself is rather creative so I wanted to
blend with that theme a little.

Thanks for both of you responses
Tony Vrolyk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top