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

Closing a form writes a record

Status
Not open for further replies.

clickster

MIS
Feb 19, 2002
89
US
I have a form to add new employees to a table. After entering data in the fields, you hit a button to add the record to the table and clear the fields on the form. That part works great. The problem is this:

When someone enters data in some or all of the fields and closes the form (without hitting the "Add Record" button), it adds a record to the table. I want to set the form so that the ONLY way to add a record is to hit the button.
 
Sounds like your form is bound to a table. Access saves records automatically. If you don't want them saved then you need to unbound your form fields from the table and manually write them yourself when you click the add button. Maq B-)
<insert witty signature here>
 
I tried unbinding the fields in the form so that they all are say &quot;unbound&quot;. But now that they're unbound, the &quot;Add Record&quot; button won't add the data to the table
 
You need to write a VB routine to save the records manually.

This thread may help you with the code.
thread181-21318 Maq B-)
<insert witty signature here>
 
You could try something like

DoCmd.CancelEvent

in the OnClose event of the Form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top