Form Image linked to variable

kip

Registered User.
Local time
Today, 07:54
Joined
Mar 19, 2012
Messages
21
Upon opening a form a value "N" (1-60) is displayed. This value corresponds to an image (Image1 - Image60) that I would like to appear on the form. I was unable to link an image using a variable. I tried another (less desirable) approach having all 60 images on the form but changing whether or not they are visible.

As far as I can tell this would require a variable in the "ImageX" here:

Forms![shapes Detail]![ImageX].Visible = True

I was unable to make that happen. This leaves me with 60 If Then statements. I'm guessing that there is a better way.

Please Help
 
An image control has a ControlSource property that can dynamically load images from folder. What is name of the control that has the N value? What is the image type?

= "path to image folder\Image" & [tbxN] & ".png"

If the images are located in a folder next to the database:

= CurrentProject.Path & "\Images\Image" & [tbxN] & ".png"

Code to set visibility of 60 Image controls:

Code:
For x = 1 to 60
Me.Controls("Image" & x).Visibility = Me.tbxN = x
Next
 
Last edited:
FYI, I moved this thread out of the introductions forum.
 
Thanks June7. That worked!
 

Users who are viewing this thread

Back
Top Bottom