Reputation: 1011
When I click on a button that creates a popup form, my VBA code Screen.ActiveForm
still references the form containing the popup button, even when the popup form has focus. How do I reference the popup form in this case? So confused why Access doesn't register the popup with focus as the active form...
Upvotes: 0
Views: 1915
Reputation: 1276
when opening/creating the pop-up form, store the form name in a variable, then reference that variable when required.
dim sPopup$
sPopup="FRM_Popup"
docmd.openform sPopup
...reference popup form here using sPopup...
Upvotes: 0
Reputation: 112259
You can use the Forms
collection which lists all open forms
Forms!MyPopup
or, if you have invalid characters in the name of the form
Forms![My Popup]
or
Forms("My Popup")
You can access controls on it with
Forms![My Popup]!TextBox1
Upvotes: 4