I need to refer to a text field by using a variable for its name.
Posted on 2011-09-10
I think this should be an easy question. I've done it before but don't remember how!
I have a form that has space for 20 images.
The image "boxes" are named imgbox01, imgbox02, imgbox03 and so forth
The images that I want to display are in the array arrImage(20)
My code loops through each image in arrImages() from n=1 to 20
when I decide to display an image in a specific box, for example, imgbox2, i need to programmatically refer to this image box.
Here is an sample of my code:
'Put the image stored in location nn in the array in the imgbox specified by n
For n=1 to 20
if <some condtion> then
Forms!frmPhotoAlbum.Image4.Picture = arrImage(nn)
Only, I do not want to hard code 4 into this line, as sometimes it will go into possition 6, or whatever the value of n currently is
So, how do I incoporate the value of n into the name of the imagebox?
in other words, if n=2 how do I code so that I can replace the 4 with the value for n?