No null fields

P

PA

I found a reference in a book instructing how to attach a macro to a form,
such that if a particular field is null, the record is not saved, the focus
is changed to the field on the form and a message box displays with
instruction to the user.
Question is, is it possible to do this for all the controls with one macro.
In the example I found, if LastName was blank the macro ran when attempting
to start the next record or close the form. I would like to do this if any
field is null.

Thanks
Paul
 
S

Steve Schapel

Paul,

Yes, it is possible to cover all fields within the one macro. Just
repeat what you have there for each field.

Another, possibly simpler and more user-friendly, approach would be to
go to the design view of the table that the form is based on, and in the
Validation Rule property of each applicable field, enter:
Is Not Null
.... and then enter something appropriate in the Validation Text
property, which is what the user will see if they leave the field blank.
 
P

PA

Thanks, works just fine.

Steve Schapel said:
Paul,

Yes, it is possible to cover all fields within the one macro. Just
repeat what you have there for each field.

Another, possibly simpler and more user-friendly, approach would be to
go to the design view of the table that the form is based on, and in the
Validation Rule property of each applicable field, enter:
Is Not Null
.... and then enter something appropriate in the Validation Text
property, which is what the user will see if they leave the field blank.
 

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