J
JamesJ
I'm trying to use the following code to confirm changes to the data.
Calling from the Before Update of the form.
Public Function ConfirmDataChange(Cancel As Integer)
Set frm = Screen.ActiveForm
Select Case MsgBox("Record(s) have been added or changed." _
& vbCrLf & "Save the Changes?", vbYesNo, "Record
Change")
Case vbYes 'go ahead and save.
'frm.Refresh
Case vbNo 'undo the changes.
Cancel = True
frm.Undo
End Select
End Function
When data is dirty and I close the form Access 2007 gives me the following
error:
Run Time 2475
You entered an expression which requires the form to be the active window
Any way around this??
It runs fine when I simply go to another record.
I'm setting the active form 'cause I have several forms that require
data change confirmation.
Calling from the Before Update of the form.
Public Function ConfirmDataChange(Cancel As Integer)
Set frm = Screen.ActiveForm
Select Case MsgBox("Record(s) have been added or changed." _
& vbCrLf & "Save the Changes?", vbYesNo, "Record
Change")
Case vbYes 'go ahead and save.
'frm.Refresh
Case vbNo 'undo the changes.
Cancel = True
frm.Undo
End Select
End Function
When data is dirty and I close the form Access 2007 gives me the following
error:
Run Time 2475
You entered an expression which requires the form to be the active window
Any way around this??
It runs fine when I simply go to another record.
I'm setting the active form 'cause I have several forms that require
data change confirmation.