E
Eoin McGlynn
I am trying to use VBA to confirm or cancel a change to a combo box. I have
the code below on the "before update" property: However I am told the discard
changes command is not available. I have also tried the acUndo commnad and
the cancel=true statement.
Private Sub Membership_Grade_BeforeUpdate(Cancel As Integer)
On Error GoTo MebershipTitleUpdate_Err
Dim strMsg As String
Dim UsrResponse As Integer
' Specify the message to display.
strMsg = "This will update the Membership Grade and chane the associated
subscription fee." & Chr(10)
strMsg = strMsg & "Click Yes to Save or No to Discard changes."
' Display the message box.
UsrResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Comitt Changes")
' Check the user's response.
If iResponse = vbYes Then
DoCmd.beep
Else
' Cancel the update.
DoCmd.RunCommand acCmdDiscardChanges
End If
MebershipTitleUpdate_Exit:
Exit Sub
MebershipTitleUpdate_Err:
MsgBox Error$
Resume MebershipTitleUpdate_Exit
End Sub
the code below on the "before update" property: However I am told the discard
changes command is not available. I have also tried the acUndo commnad and
the cancel=true statement.
Private Sub Membership_Grade_BeforeUpdate(Cancel As Integer)
On Error GoTo MebershipTitleUpdate_Err
Dim strMsg As String
Dim UsrResponse As Integer
' Specify the message to display.
strMsg = "This will update the Membership Grade and chane the associated
subscription fee." & Chr(10)
strMsg = strMsg & "Click Yes to Save or No to Discard changes."
' Display the message box.
UsrResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Comitt Changes")
' Check the user's response.
If iResponse = vbYes Then
DoCmd.beep
Else
' Cancel the update.
DoCmd.RunCommand acCmdDiscardChanges
End If
MebershipTitleUpdate_Exit:
Exit Sub
MebershipTitleUpdate_Err:
MsgBox Error$
Resume MebershipTitleUpdate_Exit
End Sub