Re: Validate textbox's with Form BeforeUdate
- From: "Ken Snell" <kthsneisllis9@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 1 Oct 2009 22:07:55 -0400
Example code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Textbox1.Value = 0 Then
Cancel = True
Me.Textbox1.SetFocus
MsgBox "Cannot have a 0 value in textbox1", vbOK, _
"Zero Not Allowed"
ElseIf Me.Textbox2.Value = 0 Then
Cancel = True
Me.Textbox2.SetFocus
MsgBox "Cannot have a 0 value in textbox2", vbOK, _
"Zero Not Allowed"
ElseIf Me.Textbox3.Value = 0 Then
Cancel = True
Me.Textbox3.SetFocus
MsgBox "Cannot have a 0 value in textbox3", vbOK, _
"Zero Not Allowed"
' continue with more ElseIf blocks as needed
End If
"Neal Ostrander" <NealOstrander@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2CC6DFD5-474D-4E60-BB2D-4B8A414ADB4B@xxxxxxxxxxxxxxxx
I want to check the values in 5 textbox's on a form if the contain any
number
other than 0 I want to check a 6th textbox to make sure its value is
greater
than 0 also. I figured the form's BeforeUpdate would be the best place to
do
this check but I am not quite sure how to set up the code to accomplish
this
task.
Thanks for any help
Neal
.
- References:
- Validate textbox's with Form BeforeUdate
- From: Neal Ostrander
- Validate textbox's with Form BeforeUdate
- Prev by Date: Re: Deleting tables
- Next by Date: Re: Validate textbox's with Form BeforeUdate
- Previous by thread: Validate textbox's with Form BeforeUdate
- Next by thread: Re: Validate textbox's with Form BeforeUdate
- Index(es):
Relevant Pages
|