Code:
Private Sub btnSaveRecord_Click()
'Catch error of incomplete form data
On Error Resume Next
'Verify form is filled
If Me.Dirty Then
'Verify expiration date is later than current date, warn user, and set focus to expiration date field
If Me.Expiration < Date Then
MsgBox ("Please enter a valid date")
txtPropertyExpiration.Value = ""
txtPropertyExpiration.SetFocus
Exit Sub
End If
'Attempt to save form. If incomplete, catch error, resume next
DoCmd.RunCommand acCmdSaveRecord
If Err.Number <> 0 Then
MsgBox ("Please Complete the form. No changes made.")
Exit Sub
End If
Else
'Notify user that Form is empty, can not be saved
MsgBox ("Please complete the form. No changes made.")
Exit Sub
End If
'Refresh data in the propertyPass subforms (First the current propertyPass, then propertyPass history
Forms!sfrmPropertyPass1.Requery
Forms!sfrmPropertyPass.Requery
Forms!sfrmPropertyPass1.updateButtons
'Close NewPropPass form
DoCmd.Close
End Sub
I know that I have asked this question before.
The above codes works on my db project. In the frmNewproperty when you click the save button the VBA code is activated.everything works.
It is what I want, I found the code in a old program and as I said it works.
I am not sure what it is doing. I understand it is checking on the expiration date, but beyond that it is a mystery.
Any help appreciated. Thanks in advance.
Respectfully,
Lou Reed