preventing record movement on Access form with navigation bar enabled

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