Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required data event 1

Status
Not open for further replies.

nq

IS-IT--Management
Apr 1, 2002
102
0
0
AU
I have a form based on a table. The table contains several fields that have "required" data. The controls on the form allow users to enter the data. The form also allows the user to change to another record.

If the user enters some data and then moves to another record before filling in all "required" data, Access displays a message indicating that data in a field is missing but the message is cryptic/meaningless to a user.

I would like to trap the event gracefully and display a message to alert the user to "required" fields that do not yet have data entered, ie. an event that is triggered on an attempt to change a record. None of the "Form events" seem to do this, or am I missing something?
 
The event you need is the Form_Error event, which is not listed with the usual events:

Code:
Private Sub Form_Error (DataErr As Integer, Response As Integer)
      Const REQUIREDFIELD_VIOLATION = 3314
      Const INPUTMASK_VIOLATION = 2279
      If DataErr = REQUIREDFIELD_VIOLATION Then
         MsgBox "There was a violation!"
         Response = acDataErrContinue
      End If
End Sub
 
Remou

Thank you, exactly what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top