losing data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have Access 2000. In the database that I have create is to issue invoices
for a Travel Agency.
There are times when agents enter in incorrect information in the date or
numberic field. The error message informs them that the data will be lost
that it cannot be saved. Is there any way to prevent this from happening.
because the invoice isssues an invoice number and it is lost also.
 
You can use the BeforeUpdate event for each control. This allows you to
cancel their entry. It goes a little something like this:


Private Sub txtMyField_BeforeUpdate(Cancel As Integer)
' Put any validation rules you like here. The key is to use the Cancel =
True to disallow the entry.
If Not IsNumeric(Me.txtMyField) Then
MsgBox "Invalid Value", vbOkOnly+vbCritical, "Error"
Cancel = True
' If you want to clear their entry, use the next line:
Me.txtMyField.Undo
End If
End Sub

By the way, it's considered verbotten to multi-post. Please read this FAQ:
http://mvps.org/access/netiquette.htm#msnews

Barry
 
Sorry about double posting, but a message said that the first did not get
posted because of some sort of error.
 
Back
Top