Macro ignores missing data

G

Guest

Hello,

I'm a relative novice when it comes to access, so I appreciate any help you
can provide.

I've set up a number of forms each linked to an individual table of course.
These tables have a number of fields were a value is required. I've also
placed a command button at the end of each form that runs a macro. The macro
opens the next form in line and closes the form that was just finished.

Here is my problem: if the data entry person leaves a required field blank,
the button/macro closes the form without displaying an error message and
giving them the chance to fill in the missing field. The macro just forces
the form closed and doesn't save ANY of the entered information in the table,
presumably because there are empty "required" fields.

Please help! Does anyone know how I can set the macro to allow for the
correction of skipped required fields? Is there a better way to link
subsequent forms?

Thanks for your help!

Jx2C
 
S

Steve Schapel

Jx2C,

You can get around this problem by forcing the form to try to save the
record before closing. In other words, put a RunCommand/SaveRecord
action in your macro in advance of the Close action.

Rather than setting the Required property of the field to Yes, you can
set its Validation Rule property to:
Is Not Null
The advantage of doing this is that you can use the Validation Text
property to have a more user-friendly message, in the place of the
Access-generated message that you get when a required field is not
completed.
 
O

onedaywhen

Steve said:
Rather than setting the Required property of the field to Yes, you can
set its Validation Rule property to:
Is Not Null
The advantage of doing this is that you can use the Validation Text
property to have a more user-friendly message, in the place of the
Access-generated message that you get when a required field is not
completed.

One *disadvantage* is that a casual observer of the schema would think
the column is nullable and may not notice the default value being
applied... If you want a user-friendly message then simply trap the
error and replace the standard text with your own.

Jamie.

--
 

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