Reputation: 49
I have been successfully using code such as:
Forms![MyForm]!Option1 = False
However, I now wish to make the above dynamic by using N = 1,2,3,4 etc. So the new code would look something like:
Forms![MyForm]!Option & N = True
Does anyone have any hints about how to make this work?
Many thanks.
Upvotes: 0
Views: 108
Reputation: 5813
You want to avoid using bang notation !
. Instead, use fully qualified references like this:
Forms.Item("MyForm").Controls.Item("Option" & N).Value = True
If you want to know more about bang notation there are SO threads like this one about it: Bang Notation and Dot Notation in VBA and MS-Access
Upvotes: 1