I am using following code to prevent access to autosave data, unless I press save button.
Form top
Form Current
Form Before update
cod on Save button (on click)
(along with other fields conditons)
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.
Form top
Code:
Private SaveRecord As Boolean
Code:
SaveRecord = False
Code:
If SaveRecord = False Then
Cancel = True
Me.Undo
Cancel = False
End If
(along with other fields conditons)
Code:
SaveRecord = True
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.