Error Handling

F

FGM

Access XP Windows 2000
Form and Subform.
User should type a record in the main form first.
If user uses the mouse to go to the subform and tries to
key data when keying the last line gets an error message
"You cannot add or change a record because a related
record is required in table tabloadTitle".

I am trying to suppress the error message and use my own
message and then I want to cancel that record (as you
would with the escape key) and return them to the main
form title field.

I found a round about way to suppress the message in
Before Update but do not know if it is the best way.

I can not find a way to clear the record (esc) and return
them to the main form. The cursor is in a field in the
subform of the main form and trying to go to the next
record in the subform.

Any help???
Thanks
 
R

Rick Brandt

FGM said:
Access XP Windows 2000
Form and Subform.
User should type a record in the main form first.
If user uses the mouse to go to the subform and tries to
key data when keying the last line gets an error message
"You cannot add or change a record because a related
record is required in table tabloadTitle".

I am trying to suppress the error message and use my own
message and then I want to cancel that record (as you
would with the escape key) and return them to the main
form title field.

I found a round about way to suppress the message in
Before Update but do not know if it is the best way.

I can not find a way to clear the record (esc) and return
them to the main form. The cursor is in a field in the
subform of the main form and trying to go to the next
record in the subform.

Any help???
Thanks

What I do is hide the subform in the Current event of the main form if on a
new record...

Me.SubformControlName.Visible = Not Me.NewRecord

....and then make it visible in the BeforeInsert event of the parent. This
makes it impossible for them to try to type in the subform until after they
have created a parent record.
 
G

Guest

-----Original Message-----


What I do is hide the subform in the Current event of the main form if on a
new record...

Me.SubformControlName.Visible = Not Me.NewRecord

....and then make it visible in the BeforeInsert event of the parent. This
makes it impossible for them to try to type in the subform until after they
have created a parent record.

Thank you.. Yes I've done that before. I am really
interested in learning the error handling techniques...

Your suggestion is appreciated...
 

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