How do I move focus to an Image object
Posted on 2010-11-29
I've been strugling with this problem for two days now:
I've got a form with about 100 Image objects and 100 textbox objects.
I would like to perform several actions on the objects, but instead of making a list in Visual Basic like:
Set ctl = image1
Set ctl = image2
Set ctl = image3
and so on I would like to make this dynamic like: Set ctl = "image" & me.imagenumber, but I haven't been able to get this to work.
I've also tried to do this with:
DoCmd.GoToControl ("Input" & Me.imagenumber) for the textbox object
DoCmd.GoToControl ("Image" & Me.imagenumber) for the image object
The strange thing is that for the textbox object it works perfectly, but when I try the same thing for the image object I get:
"Run-time error 2110 - access can't move the focus to the control"
It's probably (hopefully?) pretty easy to solve, but so far I haven't been able to find a solution and it's getting pretty frustrating.
Any help will be very much appreciated.