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

Form Entry Cancel

Status
Not open for further replies.

cpaige

Programmer
Jun 19, 2000
86
CA
Hi Everyone,
I want to make a form in Access using bound controls that would have save and cancel buttons. It seems that soon as an entry is made it is inserted into the database. I want to be able to press cancel and remove this new record. Does anyone know how to do this

Thanks,

Clayton T. Paige
claytonpaige@yahoo.ca

Programmer Extraordinaire

========================================================

"Who is General Failure? and Why is he reading my disk drive?"
 
Hi

The changes are saved when you move off the record or close the form

disable any navigation or form close buttons, when you allow editing, after you save or undo, enable tehr navigation and form close buttons

code to undo and save is:

In the onclick event of your save button

If me.Dirty Then
docmd.runcommand acCmdUndo
End if

In the onclick event of your save button

If Me.Dirty
docmd.runcommand acCmdSaveRecord
End if

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks!

That's exactly what I needed.

Clayton T. Paige
claytonpaige@yahoo.ca

Programmer Extraordinaire

========================================================

"Who is General Failure? and Why is he reading my disk drive?"
 
You will need to write a macro or some VBA for your delete button. When the user clicks it, it will fire off a DELETE Query that will remove the record.

Bellow is an example of how this may look in VBA.

SQLstr = "DELETE Attendies.*
FROM Attendies
WHERE (((Attendies.ID_Number)= " & Me.ID_Number & "));

The statement (" & Me.ID_Number & ") is the field on your form that has the Index key in it. The query will delete all the values of the fields in your query when the index number = the value on the form

Hope this helps

GTLoco
 
Quote
________________________________

"The changes are saved when you move off the record or close the form"
__________________________________

This isn't always true. If you form is a dynaset form (default for forms in access) then as soon as you start typing in any field on the form, a record is created on the table. If your form is snapshot, the it will only be saved if you use the save record function.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top