I have setup all my form validation in the BeforeUpdate event.
I know that Access will auto save the current record when you scroll to the next record, which works fine with my BeforeUpdate validation code.
However, some users users just like pressing the "Save" button, becuase it makes them feel confident the records they are entering are being recorded.
So I've included a "Save" button (using the button Wizard).
However, rather than copying all my form validation code from the BeforeUpdate event to the OnClick event of my Save button, I just thought I could branch to the BeforeUpdate event before running the save command.
Here's my code idea:
I know that Access will auto save the current record when you scroll to the next record, which works fine with my BeforeUpdate validation code.
However, some users users just like pressing the "Save" button, becuase it makes them feel confident the records they are entering are being recorded.
So I've included a "Save" button (using the button Wizard).
However, rather than copying all my form validation code from the BeforeUpdate event to the OnClick event of my Save button, I just thought I could branch to the BeforeUpdate event before running the save command.
Here's my code idea:
Code:
Private Sub btnSaveRecord_Click()
On Error GoTo Err_btnSaveRecord_Click
'GoTo Form_BeforeUpdate - validatebeforesaving
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Refresh
Exit_btnSaveRecord_Click:
Exit Sub
Err_btnSaveRecord_Click:
MsgBox Err.Description
Resume Exit_btnSaveRecord_Click
End Sub