Run-time 13 Text field

  • Thread starter Musa via AccessMonster.com
  • Start date
M

Musa via AccessMonster.com

Hi,

I have the following :
Private Sub Command160_Click()
Dim blnMissingData As Boolean
If IsNull (Me.Staff_Name) And (Me.Location) And (Me.Gender) Then
Me.Command166.Enabled = False
Else
Me.Command166.Enabled = True
MsgBox "You may proceed to the next page"
Exit Sub
End If
End Sub

I get a run-time error 13 Type Mismatch, whenever I use text fields above.
The error does not occur when I remove the text fields and only have the
numeric.

Doe anyone have a way in which I may reference the text fields ?
 
D

Douglas J. Steele

What is it you're trying to do? If it's disable the button if any of
Me.Staff_Name, Me.Location or Me.Gender is Null, your code should be:

Private Sub Command160_Click()
Dim blnMissingData As Boolean

If IsNull (Me.Staff_Name) Or IsNull(Me.Location) Or IsNull(Me.Gender) Then
Me.Command166.Enabled = False
Else
Me.Command166.Enabled = True
MsgBox "You may proceed to the next page"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top