Hello Access-Programmers,
I am trying to read the value of a control on an open form from a Public Function in a Module with no luck. I suspect the issue is syntax.
The variables pass through fine but the If statement equals zero regardless of the state of the form’s control. I tried several variations to no avail.
If Forms(varFormName).Form.Controls(varContactControl) = True Then
If Forms(varFormName)!Form.Controls(varContactControl) = True Then
Etc.
Any help on getting this right is greatly appreciated.
I am trying to read the value of a control on an open form from a Public Function in a Module with no luck. I suspect the issue is syntax.
Code:
Public Function MyFunction(varFormName As String, varControlName As String)
If Forms(varFormName).Controls(varControlName) = True Then [COLOR=seagreen]' = 0 even when control is -1[/COLOR]
Else
End If
End Function
If Forms(varFormName).Form.Controls(varContactControl) = True Then
If Forms(varFormName)!Form.Controls(varContactControl) = True Then
Etc.
Any help on getting this right is greatly appreciated.