L
Lorenzo
Hello,
I am trying to create a public Sub that prompt the user to save changes made
on the various forms throughout the application.
I have something that works just fine at the form level, but what if I want
to have this functionality for all the forms and writing the code in just
one place. I am working on a module called modSalvataggio that should
contain the code to perform this check and to be available to all forms.
The code at the form level is the following and it is a snippet from
Microsoft
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
On Error GoTo Err_BeforeUpdate
' The Dirty property is True if the record has been changed.
If Me.Dirty Then
' Prompt to confirm the save operation.
If msgBox("Data has changed " & vbCrLf & "Do you want to save ? ",
vbYesNo + vbQuestion, _
"Save Record") = vbNo Then
Me.Undo
End If
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
msgBox Err.Number & " " & Err.Description
Resume Exit_BeforeUpdate
End Sub
I am little lost can I get some help?
Lorenzo
I am trying to create a public Sub that prompt the user to save changes made
on the various forms throughout the application.
I have something that works just fine at the form level, but what if I want
to have this functionality for all the forms and writing the code in just
one place. I am working on a module called modSalvataggio that should
contain the code to perform this check and to be available to all forms.
The code at the form level is the following and it is a snippet from
Microsoft
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
On Error GoTo Err_BeforeUpdate
' The Dirty property is True if the record has been changed.
If Me.Dirty Then
' Prompt to confirm the save operation.
If msgBox("Data has changed " & vbCrLf & "Do you want to save ? ",
vbYesNo + vbQuestion, _
"Save Record") = vbNo Then
Me.Undo
End If
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
msgBox Err.Number & " " & Err.Description
Resume Exit_BeforeUpdate
End Sub
I am little lost can I get some help?
Lorenzo