Required Fields

$lim

Registered User.
Local time
Yesterday, 22:33
Joined
Dec 14, 2004
Messages
21
Is there any way that you can have required fields in a form, but access will not look for the required fields until you try to exit the form. Basically; i have a form that users keep track of there work hours on specific parts. they leave the form minimized for most of the day. After they enter a record, they sometimes need to go back and edit a previous record, only they are on a new record and access will not let them go to a previous record unless they have the record fields entered.
 
Keep in mind that a whether a field is required or not is determined by the table. When a user attempts to move to a new record in a form Access tries to save changes to the previous record, and the table complains if that record violates table rules.
One solution is to set the default value of the field in question, and this can be accomplished at the table or the form level.
 
Paste the code on form before update

If IsNull([Field1]) Or IsNull([Field2]) Or IsNull([Field3]) Then
Beep
MsgBox "Please key a value for each of the required fields.", vbCritical, "Incomplete Data Entry"
DoCmd.CancelEvent
Exit Sub
End If

hth,
Michael
 

Users who are viewing this thread

Back
Top Bottom