Test which Main form a Subform is using

C

Cathy

In Access 2003 have a subform that I am re-using within several different
Main forms. My issue is that I need to put some validation coding on the
subform. (ie. Validate that data in one field on the subform is coordinating
properly with other fields.) Whenever I write this validation code I need to
specify the main form when refering to the fields in the subform. Is there a
way I can test which Main form I am in and then create an if/then statement
to use the correct validation for that Main form?

If you have a different solution, I'm open to suggestions!

Thank you,
 
M

Marshall Barton

Cathy said:
In Access 2003 have a subform that I am re-using within several different
Main forms. My issue is that I need to put some validation coding on the
subform. (ie. Validate that data in one field on the subform is coordinating
properly with other fields.) Whenever I write this validation code I need to
specify the main form when refering to the fields in the subform. Is there a
way I can test which Main form I am in and then create an if/then statement
to use the correct validation for that Main form?


The main form can be referenced from any of its child
subforms by using Parent. E.g.

If Parent.mainformcontrol = Me.subformcontrol Then
 

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