I am wanting to move all of my support code from my form to a module. However, I seem to be having difficulty. When I try to do this, I seem to not be getting all of my references formy controls on my form. For instance, I have a listbox. I lose my reference for ITEMSELECTED. What am I doing wrong?
If you move the code to a module, statement 1 will tell you that the variable has not been defined, statement 2 will generate a compile error (Me keyword is not accepted outside a form/report). It's only statement 3 that works, because you fully qualify the control you're referring to.
Therefore, you have to declare and set the control within your module:
Dim myctr as Control
Set myctr = Forms("FormName")("ListBoxName")
Now you should be able to work with ItemsSelected...