Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Properties from VBA

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
0
0
US
I have several pictures on a form. When the user needs to see alarger picture, he double clicks the one hw wants. A new form pops up with an enlargement of that photo. This has been working fine. It just quit. Now, all that pops up is a blank form.

The code I am using is:
On Error Resume Next

Dim file As String
file = "C:\Documents and Settings\auheatw1\my _ Documents\RCFA SP\Pictures\" & Me!Picture1
Forms![frmLargePicture]!picture.Properties("Picture") = file
DoCmd.OpenForm "frmLargePicture"

Picture1 is the file name of the picture. Any help would be appreciated.
Thanks
 
You really have a subdirectory named my _ Documents ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
It really is "My Documents" The _ is a typo here, not in the actual code.

Thanks for the reply
 
WHat happens if you open the form, then assign the picture, like below??

Dim file As String
file = "C:\Documents and Settings\auheatw1\my Documents\RCFA SP\Pictures\" & Me!Picture1

DoCmd.OpenForm "frmLargePicture

Forms![frmLargePicture]!picture.Properties("Picture") = file
 
How are ya billheath . . . . .

In . . .
Code:
[blue][purple][b]Forms[/b][/purple]![frmLargePicture]!picture.Properties("Picture") = file
DoCmd.OpenForm "frmLargePicture"[/blue]
. . . [purple]Forms[/purple] is the [blue]collection of all open forms![/blue] To be included in the collection a form has to be [blue]open in either form or design view.[/blue] And ya can't [blue]change anything in a closed form[/blue] (I'm a little surprised an error didn't occur here!).

So . . . . reverse the lines and [purple]open the form first.[/purple]

[blue]I have a feeling someone reversed the lines in an attempt to have the form open with the picture preloaded, or no visual update![/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks, AceMan and Rob! That's ezactly what happened! I looked at an older version and it was reversed. Why or how it got changed, I don't know. It's working now.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top