calcrisk33
New member
- Local time
- Today, 07:04
- Joined
- Sep 21, 2012
- Messages
- 3
I am trying to get the value of a combobox after selecting an "OK" button but get "You can't reference a property or method for a control unless the control has the focus."
I understand what this means, but how to I get around it?
Most would probably say use .Value but when I press "OK" I am prompted for a value, or as in another case get Null. Again, I understand why I am getting these results but need a workaround.
I tried setting the focus prior to the violating line of code, but no go.
Example:
Thanks in advance.
I understand what this means, but how to I get around it?
Most would probably say use .Value but when I press "OK" I am prompted for a value, or as in another case get Null. Again, I understand why I am getting these results but need a workaround.
I tried setting the focus prior to the violating line of code, but no go.
Example:
Code:
Private Sub viewByRegionOKButton_Click()
DoCmd.OpenReport "byRegionReport", acViewPreview, , "RegionName = '" & regionComboBox.Text & "'"
End Sub
Thanks in advance.