mardi 6 novembre 2018

Access VBA not returning If statement correctly

I have a function in Access VBA that returns True or False:

Private Function NumberCheck() As Boolean
    If Me.txtMajor Like "[!0-9]" Then
        NumberCheck = True
    Else
        NumberCheck = False
    End If
End Function

When txtMajor has a 1 in the box, I get NumberCheck = False instead of True. As well as the opposite being the case if I put some other character in other than a number. Then NumberCheck will show True instead of False. Can someone please explain this to me?

Aucun commentaire:

Enregistrer un commentaire