By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

close button on tab form

P: 2
I have a form with 4 tab pages
on the 2 tab page I have a subform that adds records to a table via 2 combo boxes.

I have been able to stop user from leaving a combo control blank or skipping to the next combo control, but if user clicks the close command button on the main form, from the 2nd combo control, it prompts that value has to be selected but the gives error:

"You cannot add or change record because a related record is required"

I do have referential Integrity on.

how can I stop this so form will close and undo the 1st combo selection and not give error?
Dec 4 '06 #1
Share this Question
Share on Google+
2 Replies


NeoPa
Expert Mod 15k+
P: 31,661
How are you controlling what the user can and can't do (please post code where used)?
I'm thinking that you could have some code in the OnClose event, but which code is hard to say without knowing how you're doing what you're doing.
Dec 4 '06 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
This usually happens when the subform table has had a new record started but the foreign key reference to the main form table hasn't been set so the new record can't be saved.

You need to be careful though as you only want to undo the subform record now the main form record presumably.

A better way to approach this would be to look at how the new record is being added to the subform and use on error validation to allow for the user changing their mind.

Mary


I have a form with 4 tab pages
on the 2 tab page I have a subform that adds records to a table via 2 combo boxes.

I have been able to stop user from leaving a combo control blank or skipping to the next combo control, but if user clicks the close command button on the main form, from the 2nd combo control, it prompts that value has to be selected but the gives error:

"You cannot add or change record because a related record is required"

I do have referential Integrity on.

how can I stop this so form will close and undo the 1st combo selection and not give error?
Dec 5 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.