preventing record movement on Access form with navigation bar enabled

A

astro

Is there a way to prevent movement to another record if customized data
validation flags current record? The on_current event does not have a
cancel option. I can code customized navigation keys but would rather use
built in functionality if possible. The validation I'm using does not look
at any of the bound data fields on the form.

Thanks.
 
A

Albert D. Kallal

Your validation code will no doubt in the forms before update event.

You can test, and use all kinds of field data from the table,a nd the
controls do NOT have to be placed on the form.

If isnull(me!CompanyName) = True then

cancel = true
msgbox "you must enter the company name"
exit sub

endif

The above code would be placed in the forms before update event. And, while
not a good example, the company field does NOT have to be placed on the
actual form for the above code to work (so, all fields can be
referenced..regardlesss if they are on the form or not, they just have to be
part of the underlying data for the form).
 

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