Set property of control on closed form

B

Billy B

I have a form with a bound picture control. Of course, the picture property
has to have a path & picture property in it. If I move the application to
another computer and the picture is another folder, I get a "Can't find
xxxxxx picture". I have a logon form and am wondering if I can set the
picture property of the EditPic control on a form named frmEditIt?

I have tried Forms!frmEditIt!EditPic.Picture = varNewPicLoc

That doesn't work.
Thanks
 
B

Beetle

Store your pictures in a folder on the network and use UNC path
naming instead of Drive Letter path naming, then it will be
the same path from every computer, i.e. the path would be;

\\ServerName\SomeFileName\SomePicture.bmp

instead of;

C:\SomeFilename\SomePicture.bmp
 
B

Billy B

Thanks. I am not using this program on a networked system. I just moved it
from my computer to the wife's. I want her to be able to create her own
folder for her own pictures and have the program set the path. What I am
trying to do is once she exits the logon form, she uses BrowseFolder to get
the folder name which will be stored in a table. There will be a graphic in
the main program folder that will be concantated with the path string. Then I
want the code to update the Picture property of the EditPic control.

Is that possible?
 
C

Clif McIrvin

Billy B said:
Thanks. I am not using this program on a networked system. I just
moved it
from my computer to the wife's. I want her to be able to create her
own
folder for her own pictures and have the program set the path. What I
am
trying to do is once she exits the logon form, she uses BrowseFolder
to get
the folder name which will be stored in a table. There will be a
graphic in
the main program folder that will be concantated with the path string.
Then I
want the code to update the Picture property of the EditPic control.

If you're using a table to store the variable information, use the forms
load event to edit the Picture property. Depending on how that table is
set up, you can add a hidden control bound to that table that has the
path & filename information you need. Something like:


Private Sub Form_Load()
me.EditPic.Picture = txtNewPicLoc.value
end sub

in form frmEditIt where txtNewPicLoc is the name of the hidden text box
bound to your variable information table. Set the control's recordsource
property to return only the single record that you need to look at.
 
B

Beetle

Probably, unfortunateley I don't know the answer. You might wait and see
if someone else picks up this thread and offers a solution. If not you might
want to re-post your question with the relevant details.
 
D

Dirk Goldgar

Billy B said:
I have a form with a bound picture control. Of course, the picture property
has to have a path & picture property in it. If I move the application to
another computer and the picture is another folder, I get a "Can't find
xxxxxx picture". I have a logon form and am wondering if I can set the
picture property of the EditPic control on a form named frmEditIt?

I have tried Forms!frmEditIt!EditPic.Picture = varNewPicLoc


I probably would not do it this way. Assuming that you really need to use a
bound image control, I'd probably use the Open event of frmEditIt to set the
Picture property of the control.

However, if you want to do this from some other form, or from code that runs
at startup, your code and open the form in design view, but hidden, make the
change to the control's Picture property, then save and close the form.
Code would be something like this "air code":

'----- start of code -----

DoCmd.OpenForm "frmEditIt", acViewDesign, _
WindowMode:=acHidden

Forms!frmEditIt!EditPic.Picture = varNewPicLoc

DoCmd.Close acForm "frmEditIt", acSaveYes

'----- end of code -----
 

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