Message box for data entry (Limit)

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

I was wondering how I could create a message box asking if the data entry is
correct, but only if the data entry exceeds lets say 15.0 in the field.
This would prompt the user to double check their entry for this number or
higher...Thanks...Randy
 
You can do this easily on a form, using the BeforeUpdate event procedure of
the text box.

This example assumes the text box is named "Amount":

Private Sub Amount_BeforeUpdate(Cancel As Integer)
If Me.Amount > 15 Then
If MsgBox("That big?", vbYesNo+vbDefaultButton2) <> vbYes Then
Cancel = True
End If
End If
End Sub
 
Thanks Allen, that works great!
Allen Browne said:
You can do this easily on a form, using the BeforeUpdate event procedure of
the text box.

This example assumes the text box is named "Amount":

Private Sub Amount_BeforeUpdate(Cancel As Integer)
If Me.Amount > 15 Then
If MsgBox("That big?", vbYesNo+vbDefaultButton2) <> vbYes Then
Cancel = True
End If
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.


entry
 
Back
Top