The code is giving me hell
I have some buttons on a subform I am using to control a parent form.
I am trying to write code to cancel a new record.
The cancelupdate and moveprevious methods do not seem to work. After I click cancel the new record still exist and it does not move to the previous record.
I am using Access 2007 and Windows Vista Home premium
I hope someone can assist me
I have some buttons on a subform I am using to control a parent form.
I am trying to write code to cancel a new record.
The cancelupdate and moveprevious methods do not seem to work. After I click cancel the new record still exist and it does not move to the previous record.
I am using Access 2007 and Windows Vista Home premium
Code:
Private Sub cmdCancel_Click()
On Error GoTo Err_cmdCancel_Click
Dim intConfirmCancel As Integer
intConfirmCancel = MsgBox("Are you sure you want to cancel this record", vbYesNo, "Confirm Delete")
If intConfirmCancel = vbYes Then
Me.Parent.Form.Recordset.CancelUpdate
SetButtons (False)
If Me.Parent.CurrentRecord > 1 Then
Me.Parent.Form.Recordset.MovePrevious
End If
End If
Exit_cmdCancel_Click:
Exit Sub
Err_cmdCancel_Click:
MsgBox Err.Description
Resume Exit_cmdCancel_Click
End Sub
I hope someone can assist me