making some fields mandatory in access data table

S

sam

how can I make some certain fields mandatory.

For eg. If I have a Table with Name, City, St, Zip, Address

what should i do to make Zip field mandatory?

Thanks in Advance.
 
J

Jerry Whittle

Open the table in design view. Go to the Zip file. Set the Required property
to Yes.
 
B

Beetle

In table design view set the Required property of that
field to Yes. As an extra precaution, and to be able to
generate a more user friendly error message, you can
use the Before Update event of your form to check the
value before the record is saved;

Private Sub Form_BeforeUdpate (Cancel As Integer)

If Nz(Me![ZipCode], vbNullString) = vbNullString Then
MsgBox "Please enter a Zip Code", vbOkOnly + vbInformation, "Incomplete"
Cancel = True
Me![ZipCode].SetFocus
End If

End Sub
 

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