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!

Don't want to save records when user navigates

Status
Not open for further replies.

kensaffer

Programmer
Jan 7, 2005
39
US
thru sub-forms. Access 2000 on SQL SERVER 2000 using ADP.
Have a main form and 7 subforms. After users put in data on main form, which is required,and use tabs to go look at the other forms, Access saves the record even tho there is no data to save. This generates many records that have no data but does have a primary key. Each form is based on a different table. How can I stop Access from saving data automatically ?
 
Access will not save the record if it is empty. The user must be entering something. You could put code into the form-beforeupdate event procedure to ask if the user wants to save or not - and if not, cancel the save.
 
Thanks you for the reply. The user is not typing anything into the form BUT because it is a subform and there is an identifyer for each record, Access assumes that since the user is on that form and exiting the form, that it must save data. The only thing saved is the identifyer, all the other fields on the form are blank.
Does this make sense the way I'm describing it ?
 
Well if the user isn't typing anything there must be some code running which is adding data to the record.
Access does not save a subform record just because you've clicked into it. It has to be dirtied either by a user entry or in code.
In either case the solution is still the same - you must use the beforeupdate event procedure of the subform to see whether the record has sufficient data to be saved and if so ask the user if they want to save it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top