Message box for data entry (Limit)

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
 
A

Allen Browne

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
 
R

Randy

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
 

Ask a Question

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.

Ask a Question

Top