T
Tony Williams
I have a subform on a tabcontrol. The subform is in continuous form format
with two combo box controls. I want a message to pop up asking the user if
they are sure they want to save the changes. I have this code in the
AfterUpdate property of the form
If vbNo = MsgBox("Are you sure you want to save the changes to the Primary
and Secondary Codes?", 36, "Save Changes") Then
Me.Undo
Cancel = True
End If
However the message appears each time the user adds a record, (the user can
add as many records to the sub form as they wish), rather than when the form
or main form is closed. I've tried putting the code in the On Close property
but I get the message even if they haven't made any changes. I've tried
changing the code on the OnClose property to this but I don't get a message
at all then.
If Me.Dirty Then
If vbNo = MsgBox("Are you sure you want to save the changes to the Primary
and Secondary Codes?", 36, "Save Changes") Then
Me.Undo
Else
Cancel = True
End If
End If
Can anyone see what I'm doing wrong?
TIA
Tony Williams
with two combo box controls. I want a message to pop up asking the user if
they are sure they want to save the changes. I have this code in the
AfterUpdate property of the form
If vbNo = MsgBox("Are you sure you want to save the changes to the Primary
and Secondary Codes?", 36, "Save Changes") Then
Me.Undo
Cancel = True
End If
However the message appears each time the user adds a record, (the user can
add as many records to the sub form as they wish), rather than when the form
or main form is closed. I've tried putting the code in the On Close property
but I get the message even if they haven't made any changes. I've tried
changing the code on the OnClose property to this but I don't get a message
at all then.
If Me.Dirty Then
If vbNo = MsgBox("Are you sure you want to save the changes to the Primary
and Secondary Codes?", 36, "Save Changes") Then
Me.Undo
Else
Cancel = True
End If
End If
Can anyone see what I'm doing wrong?
TIA
Tony Williams