I am using following code to prevent access to autosave data, unless I press save button.
Form top
Code:
Private SaveRecord As Boolean
Form Current
Code:
SaveRecord = False
Form Before update
Code:
If SaveRecord = False Then
Cancel = True
Me.Undo
Cancel = False
End If
cod on Save button (on click)
(along with other fields conditons)
Code:
SaveRecord = True
This works fine without any problem for one form (without subform).
Problem:
But I have problem, when I have subform
With above, If I jump to subform, data filled in Main form is deleted.
If I dont use above code, data of main form is saved before I type something in subform and then confirm to save records by pressing save button.
(I can undertand, the code before update is deleting Mainform records, but solution?)
How can I solve this issue to add data of Mainform and subform at the same time, after I press save button.
1) Prevent the main form to autosave
2) meanwhile I can add data to subform
Finally press save
Note: I dont want yes/no popup messages for confirmation.