Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: Macro ignores missing data

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Macro ignores missing data
Jx2C 30.09.2006 20:09:02
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
Re: Macro ignores missing data
Steve Schapel <schapel[ at ]mvps.org.ns> 01.10.2006 02:19:41
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.

--
Steve Schapel, Microsoft Access MVP

Jx2C wrote:
[Quoted Text]
> 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

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net