Hello,
I have a main form with a subform and am trying to figure out the best way to have users save data that is entered.
I know that access automatically saves data entered but I would like to avoid that for instances in which a user enters partial information into a record, and either doesn't finish or makes a mistake and closes out, thinking that that won't save the data.
I would like a prompt that occurs on close of the form that will save the information that's been entered in both the main and subforms.
I have this code in the main form's on close event:
And similar code in the subform's before update event.
What's happening now is that even if the user enters partial information only in the main form, the prompt does not occur and the information is saved anyways.
Could someone please offer any advice on how to clean up these saving issues? I'm no programmer, so any help would be greatly appreciated.
I have a main form with a subform and am trying to figure out the best way to have users save data that is entered.
I know that access automatically saves data entered but I would like to avoid that for instances in which a user enters partial information into a record, and either doesn't finish or makes a mistake and closes out, thinking that that won't save the data.
I would like a prompt that occurs on close of the form that will save the information that's been entered in both the main and subforms.
I have this code in the main form's on close event:
Code:
On Error GoTo Close_Error
If Me.Dirty Then
If MsgBox("The record has changed - do you want to save it?", _
vbYesNo + vbQuestion, "Save Changes") = vbNo Then
Me.Undo
End If
End If
Close_Exit:
Exit Sub
Close_Error:
MsgBox Err.Description
Resume Close_Exit
And similar code in the subform's before update event.
What's happening now is that even if the user enters partial information only in the main form, the prompt does not occur and the information is saved anyways.
Could someone please offer any advice on how to clean up these saving issues? I'm no programmer, so any help would be greatly appreciated.
Comment