No null fields

  • Thread starter Thread starter PA
  • Start date Start date
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
 
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.
 
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.
 
Back
Top