Hi,
I want to put an event within an event but it seems as though this can't be done and I need to figure a work around. Basically I am trying to say that if the user clicks on the 'cmdRenewTraini ng' button then it just saves the record without the prompt asking if they wish to save. If they dont press the 'cmdRenewTraini ng' button then I want the prompt to ask them if they want to save changes. The code looks to make sense but I think the reason Access wont allow it is because it's an event within an event, any ideas how I can get around this problem please? I'm guessing I need to remove lines 2-5 and bring them outside the Private Sub Form_BeforeUpda te(Cancel As Integer)??
Thanks
I want to put an event within an event but it seems as though this can't be done and I need to figure a work around. Basically I am trying to say that if the user clicks on the 'cmdRenewTraini ng' button then it just saves the record without the prompt asking if they wish to save. If they dont press the 'cmdRenewTraini ng' button then I want the prompt to ask them if they want to save changes. The code looks to make sense but I think the reason Access wont allow it is because it's an event within an event, any ideas how I can get around this problem please? I'm guessing I need to remove lines 2-5 and bring them outside the Private Sub Form_BeforeUpda te(Cancel As Integer)??
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If cmdRenewTraining_Click() Then
DoCmd.Save
End If
Else
If MsgBox("Changes have been made to this record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Have Been Made") = vbYes Then
DoCmd.Save
Else
DoCmd.RunCommand acCmdUndo
End If
End If
End Sub
Comment