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?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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
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.