Validating Data on a Form with a subForm

D

DeltaHall

I have a form with subforms with data validation in the main Form's
Before_Update Event. The problem that I am encountering is when the user has
not updated all required data but enters the subform the Form Before_Update
Event fires and the validation will fail. Is there a way to know what the
next object has been selected might be or how I would not perform the Form's
validation when the subform has been selected?

Any help will be appreciated!!!
 
A

Allen Browne

No. Access saves the main form's record at the point when you move from the
main form into the subform. Any record that fails validation cannot be
saved.

By definition, you cannot have a validation record that allows the record to
be saved if it does not meet the rule.
 
D

DeltaHall

I am okay with the record being saved at this point but since the user has
not moved off the current record, there still is time for them to complete
the form(required fields) once they set focus back to something on the main
form.

Can you suggest any alternate ways of accomplishing this task?

Is there no call stack in Access that is accessible to the developer?
 
A

Allen Browne

There is no event that fires after a record is saved and before you move to
another record.

There are many other things that could also cause the related record to be
missed other than explicitly moving record, e.g. applying a filter, changing
the sort order, closing the form, closing Access, Requery, ...

In essence, there's no way to require a related record to be entered, since
the main record must be saved before the related record can be created.

(An important corollary is that you need to know how to use outer joins in
queries.)
 

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