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

Cancel button values

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
0
0
US
Hi

I want to have an operation using a button that will enable me to cancel changes made by an operator. At present I have an input screen which is filtered so any changes made to the fields will be automatically saved (as the text boxes in the form are linked directly with the table where the data goes). I want to be able to have a facility which accommodates for mistakes.

e.g.

I go into my input screen I enter an address and when coming to save it I realise that this record has been inputted already by another person. So i would like a button which when clicked the inputted information is discarded and not saved to the database.


Thank you for your help
 
Private Sub btnClearFields_Click()

'Basically, write some code here to set each field value
on the form to "" or Null

with Forms!YourForm
!field1 = Null
!field2 = Null
...
!fieldX = Null
end with

end sub


HTH

Greg Tammi, ATS Alarm Supervisor
 
Try this:

==========
Private Sub cmdCancel_Click()
If Me.Dirty Then
If MsgBox("Are you sure you wish to cancel adding this record?", vbQuestion + vbYesNo, " Continue?") = vbYes Then
Me.Undo
DoCmd.Close
End If
End If
End Sub
========== Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Oops...my bad!

Forgot about the Dirty property...thanks Jimmy. :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top