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 realize that it is logical to have data from the main form saved as soon as something is put into the subform to prevent parent-child discrepancies, but if a user only enters partial or erroneous data in the main form and nothing in the sub-form I don't want that to be saved.
What I would like to do is have a prompt that occurs on close of the form that will save the information that's been entered in both the main and subforms. Or prevent saving in both the main and sub forms unless the user actually clicks a "Save" button.
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.