L
LG
How do I go about putting something on a form's field that says a number must
be entered besides a 0?
be entered besides a 0?
Dale Fye said:Lets try this again. I was not paying close enough attention to the name of
your fields (or controls). I use a naming convention for all of my controls
so that I know whether I'm referring to a control on the form, or directly
refering to a field value.
Private Sub REASON1_BeforeUpdate(Cancel As Integer)
If Len(Me.REASON1 & "") = 0 Then
'This first line checks to make sure there is something
'in the field, so if the length of the value in the field plus
'an empty string is zero, then there is obviously a problem
msgBox "Enter a value in this field!"
Cancel = True
ElseIf Me.REASON1 = 0 Then
'If there is a value in the field, then check to see if it is 0
'If so, display an error message
MsgBox "Value cannot equal 0!"
Cancel = True
End If
End Sub