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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form adds record to table on close / exit

Status
Not open for further replies.

talbotlives

Technical User
Jul 14, 2005
7
US
Hi-
thanks for taking the time to look at my question (im kinda new to access so this is probably a dumb question)
My input form is adding records to its table when I click the exit button (or the X at the top), as well as when I click the add record button. Naturally, I only want it to add to the table when someone clicks the add record, and not when they fill out half of the form and then close it. Does anyone know what might be causing this? thanks in advance.
 
It's how Access operates.

Per MS Access HELP File:
Microsoft Access automatically saves the record you are adding or editing as soon as you move the insertion point to a different record, or close the form or datasheet you are working on.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Hi Ginger-
Thanks for the reply. Any recommendations on how to fix this? My thoughts are some type of delete query to delete anything not actively saved.
 
Some options: you can UNDO any changes made to the current record, but the user has to do this before moving to another record. If you have any subforms, forget it...that data will update as soon as you leave the subform and go back to the main form. So there's a menu item for UNDO that you can pick, or you can make a button and use the wizard to have it contain the UNDO code. So, as I said, only changes made to the current record can be undone up until the point that you leave that record.

Another option is to use UNBOUND forms. There's a lot in this forum written about that. Essentially, the form is not bound to a table (no recordsource). When opening the form, you fill it with data from the table that is for the record that you want to see. The user messes with the data, and if they want to save it, they hit a SAVE button which then replaces the current data in the table with the new data for that record. That takes a bit of work and can seem a little daunting at first, but it's not too bad. If you want to go this route, look up unbound forms and DAO recordsets. Let us know how it goes.

g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top