Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prevent automatic updates on main form when going to subform

Status
Not open for further replies.

Gerilee

Programmer
Mar 23, 2001
47
US
I have a main form and a subform. The main form has a SAVE command button as I do not allow automatic updates on it. But, when I tab or click in the subform, any changes that I made to the main form are automatically saved. I tried to handle this by putting some code in an event that would be triggered when the user went from the main form to the subform. I tried the OnLostFocus and the OnDeactivate events of the main form but that didn't work. I can't seem to figure out what events are triggered when the user moves from the main form to the subform. Is this the best way to handle this or is there another way to prevent the automatic updating of the main form when switching to the subform? Thanks much for any help.
 
Hi!

Access has to save the record on the main form before continuing to a subform otherwise there would be no record in the main table to link to and connection between the tables would not work.

That said try putting some code in the Enter event for the subform control which will ask if the user wants to save the record. I don't know if that will work or not because the record may be saved by that time. Make sure to let the user know that, if they don't save the record, they will not be able to fill the subform

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Hi jebry,

This definitely helped me to realize that I was on the right track. The tables are linked by SSN which I am not allowing the user to change to I thought that I may be able to "catch" the update before actual focus went to the subform. I had already put some code in the Enter event for the subform control so after reading your idea, I'm just going to give the user a message that the record on the main form was saved. Thanks and have a great weekend!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top