Overide Validation

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,

I have created a macro to close one form and load a new
one. The problem is if the user hasn't specified a number
in the primary key field it throws up an error message.
Unfortunately this field needs to be user input and so
the only option is to override this message when the
macro is closing the form. Can this be done?

The record doesn't need to be saved but setting the save
prompt option to no in the macro has no effect on the
validation.

Ideas would be greatfully received.

Thanks

Martin
 
Martin,

Try putting another macro in the Before Update event of the first form,
with Condition along these lines...
[NameOfYourPrimaryKeyField] Is Null
.... with these events
CancelEvent
RunCommand/Undo

Sorry, I didn't test this, but I think it might do the trick.
 
Hi Steve,

That has cleared the PK messages but now it comes up with
a new message box. "You Can't Save This Record At This
Time" - it then goes on about finding some error and not
being able to save the record in the file. Any ideas on
how to get rid of this one?

Cheers

Martin
-----Original Message-----
Martin,

Try putting another macro in the Before Update event of the first form,
with Condition along these lines...
[NameOfYourPrimaryKeyField] Is Null
.... with these events
CancelEvent
RunCommand/Undo

Sorry, I didn't test this, but I think it might do the trick.

--
Steve Schapel, Microsoft Access MVP

Hi,

I have created a macro to close one form and load a new
one. The problem is if the user hasn't specified a number
in the primary key field it throws up an error message.
Unfortunately this field needs to be user input and so
the only option is to override this message when the
macro is closing the form. Can this be done?

The record doesn't need to be saved but setting the save
prompt option to no in the macro has no effect on the
validation.

Ideas would be greatfully received.

Thanks

Martin
.
 
Back
Top