S
suek
I am trying to put the following code in the after update event:
Private Sub Form_AfterUpdate()
On Error GoTo Err_cmdsave_Click
Dim strUpdate As string
strUpdate = MsgBox("Do you really want to save this form?", vbYesNo,
"Amend Records")
If strUpdate = vbYes Then DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70
ElseIf strUpdate = vbNo Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
Exit Sub
Exit_cmdsave_Click:
Exit Sub
Err_cmdsave_Click:
MsgBox Err.Description
Resume Exit_cmdsave_Click
End Sub
but it keeps telling me my if statement is wrong. This project is my first
foray into coding, and I am doing it from the help menu in visual basic, but
I cannot track where the error is looking at the code.
Can someone help me please? I am trying to prompt the user to save their
stats prior to updating the database, otherwise do the equivalent of hitting
the escape button and not saving them prior to leaving the form.
Thanks
Private Sub Form_AfterUpdate()
On Error GoTo Err_cmdsave_Click
Dim strUpdate As string
strUpdate = MsgBox("Do you really want to save this form?", vbYesNo,
"Amend Records")
If strUpdate = vbYes Then DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70
ElseIf strUpdate = vbNo Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
Exit Sub
Exit_cmdsave_Click:
Exit Sub
Err_cmdsave_Click:
MsgBox Err.Description
Resume Exit_cmdsave_Click
End Sub
but it keeps telling me my if statement is wrong. This project is my first
foray into coding, and I am doing it from the help menu in visual basic, but
I cannot track where the error is looking at the code.
Can someone help me please? I am trying to prompt the user to save their
stats prior to updating the database, otherwise do the equivalent of hitting
the escape button and not saving them prior to leaving the form.
Thanks