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!

sendkeys alternative

Status
Not open for further replies.

jurgen

Programmer
Feb 8, 2001
209
BE
Does some one have another way, then to cancel the current changes with SendKeys "{ESC}" ?

I'm trying to create a cancel button on a form... undo doesn't work in this case.

JJ
 
Hi There JJ

One think you could do is ask the user if they want to save the record or undo the changes they made. You can you the Forms BeforeUpdate Event to do this.

Example
--------
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Data has changed. Do you wish to save the changes?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
'do nothing

Else
DoCmd.RunCommand acCmdUndo
End If
End Sub


Hope This Helps Bernadette
 
Bernadette,
Could you explain the DoCmd.RunCommand acCmdUndo
code a little more? I'm trying to do something similar, and I'm getting a Runtime error 2046, The command or action 'Undo' isn't available now. Can the command only be ran at certain times?

I have a subform on my form, and I think what's happening is that my information is being entered into table as soon as I go to subform...is there another code could I use to undo this? ( Do I have to use a delete query? )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top