To help users enter the correct information every time they use a VBA form we can apply some validation checks. |
Private Sub productID_Change()
If IsNumeric(productID.Text) = False Then
MsgBox "The product ID must be a number"
productID.Text = ""
End If
End Sub
The code is applied to the change event of the field and makes sure it only receives numbers. If an illegal character is entered it pops up a message asking for the correct input and then clears the field ready for the next attempt.
No comments:
Post a Comment