Subform error

J

Joe Williams

I have a main form with a subform for detail records. The problem I am
having is that the use wants to jump right into the subform and start
entering records, which gives you a nasty access error message becuase some
of the fields on the main form are required. The error will continue until
the user pressing ESC or crashed completely out of access.

Is there a way to prevent the user from going to the subform until the
required fields on the main form have been filled out? Or another way to
trap this error?
 
M

Marshall Barton

Joe said:
I have a main form with a subform for detail records. The problem I am
having is that the use wants to jump right into the subform and start
entering records, which gives you a nasty access error message becuase some
of the fields on the main form are required. The error will continue until
the user pressing ESC or crashed completely out of access.

Is there a way to prevent the user from going to the subform until the
required fields on the main form have been filled out? Or another way to
trap this error?


You can use the Form's Error event to trap the validation
violations.

You could also use the form's BeforeUpdate event to check
for these conditions and set Cancel = True to prevent the
focus moving to the subform. You could event make the
subform invisible and only make it visible when your
BeforeUpdate tests pass.
 
J

Joe Williams

Marshall,

Good idea. i never even thought about making the subform invisible. Thanks!

- joe
 

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

Similar Threads

check empty subform 5
Multiple subforms 0
Access Main form/Subform Navigation 0
subform total behaving strangely 2
Another Question on Subforms 2
Copy text to subform 2
Need Help on SubForm 5
calculated control event order 2

Top