Error Handling

  • Thread starter Thread starter FGM
  • Start date Start date
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
 
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.
 
-----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...
 
Back
Top