Subform error

  • Thread starter Thread starter Joe Williams
  • Start date Start date
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?
 
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.
 
Marshall,

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

- joe
 
Back
Top