0

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.

braX
  • 11,506
  • 5
  • 20
  • 33
PJ99
  • 49
  • 6

1 Answers1

1

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

HackSlash
  • 4,944
  • 2
  • 18
  • 44