Customer Textbox Validator

Moore71

DEVELOPER
Local time
Today, 15:03
Joined
Jul 14, 2012
Messages
158
Hi,
I have 2 controls, a textbox and combo box. I want to prevent users from entering anything other than number integers on the textbox and only strings on the combo box.
I want codes that will prevent users by customized msgbox instead of default access error message. I am using ms Access 2010.
Thanks for your reply.

Regards,
Moore71
 
You can use the On Change event of the text box or combo box to trigger the check, then you can do something like.
Code:
Private Sub yourTextBoxName_Change()
    If Not IsNumeric(yourTextBoxName) Then
        MsgBox "Be careful, you cannot enter a String here", vbCritical
    End If
End Sub

Private Sub yourComboBoxName_Change()
    If IsNumeric(yourComboBoxName) Then
        MsgBox "Be careful, you cannot enter a Numbers here", vbCritical
    End If
End Sub
The code should be get you started, but will not give you the complete solution.
 
Hi,
thank you very much for the response.
It worked perfectly. Thanks
 

Users who are viewing this thread

Back
Top Bottom