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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required field code 1

Status
Not open for further replies.

RGarcia87

Technical User
Jun 24, 2002
506
US
Need code for an Access 2007 form. When a user exits the form and a certain field is not filled I want it to say "This field is required!". I would really appreciate it.
 
Put a message box in the form's unload event inside an IF statement. If the field is not filled, set cancel = true.

Cogito eggo sum – I think, therefore I am a waffle.
 
Or can do it in BEFORE UPDATE with a message box:

If IsNull(Me!txtField) Then
MsgBox "FIELDNAME is required", vbOKOnly, "Rqd Field Missing"
Cancel = True
Me!txtField.SetFocus
End If


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top