Full Version: Referencing an unbound textbox...
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
ILJester
Hello Everyone,

I hope this is the right place for this, it kinda seems like a coding issue. I am getting the following error message when trying to ascertain the length of an unbound textbox :

Error 2185 : You can't reference a property or method for a control unless the control has focus.

Here is the code contained in a command button:

Private Sub cmdProcess340_Click()
Debug.Print Me.txtMBRNBRs.Text 'This gives the same error
If Len(Me!txtMBRNBRs.Text) > 0 Then
MsgBox "it is"
End If
End Sub

None of this works. I am a pretty hardcore VB person, but not too much into access forms (yuck). Any idea what I am doing wrong here or am I under a misconception about something. Thanks much,
jsitraining
Hi
try
Private Sub cmdProcess340_Click()
Debug.Print Me.txtMBRNBRs 'This gives the same error
If Len(Me!txtMBRNBRs) > 0 Then
MsgBox "it is"
End If
End Sub

HTH
Jim
ILJester
Wow, that was easy. Thanks jsitraining.
jsitraining
No bother. Glad to help.
Jim
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.