J
Joan Edington
Hi,
I've been reading this group all day looking for someone with my
problem but everyone else seems to have the opposite happening.
I have a form which contains a subform. The format is the mainform
stuff on page 0 of a tabbed control, the subform on page 1 tab.
On the tab_control's change event I set a field on the subform to a
value on the main form.
I enter the relevant data on the mainform page 0 then click on the tab
to move to page 1. The mainform record is automatically saved, as
expected, and the subform appears with the field filled in, also as
expected.
However, it dropped into my validation routine for the subform and
immediately displayed an error message saying that fields can't be
blank etc. I didn't expect the subform to try and save automatically
at that point.
I put msgboxes in my events on both the mainform and subform to try
and track what was happening and this is the sequence of events from
creating a new mainform.
1. Subform_OnCurrent.
2. Mainform_OnCurrent.
I enter data then click on the tab for the page containing the
subform.
3. Mainform_ BeforeUpdate.
4. Subform_OnCurrent.
5. Subform_BeforeUpdate.
This gives the validation error because I've not had a chance to enter
anything. I say OK to cancel the save.
6. TabControl_Change.
Basically my questions are:-
Why does the subform save at this point?
Why is it dirty anyway when the code to change the field isn't
actioned until after the save?
Is there any way to stop the save of the subform record?
All I want to do is to have the mainform record saved and the subform
open for input, but with that one field pre-set. It doesn't sound like
rocket science but I'm well stumped.
Any help would be very greatly received.
Thanks.
Joan Edington
I've been reading this group all day looking for someone with my
problem but everyone else seems to have the opposite happening.
I have a form which contains a subform. The format is the mainform
stuff on page 0 of a tabbed control, the subform on page 1 tab.
On the tab_control's change event I set a field on the subform to a
value on the main form.
I enter the relevant data on the mainform page 0 then click on the tab
to move to page 1. The mainform record is automatically saved, as
expected, and the subform appears with the field filled in, also as
expected.
However, it dropped into my validation routine for the subform and
immediately displayed an error message saying that fields can't be
blank etc. I didn't expect the subform to try and save automatically
at that point.
I put msgboxes in my events on both the mainform and subform to try
and track what was happening and this is the sequence of events from
creating a new mainform.
1. Subform_OnCurrent.
2. Mainform_OnCurrent.
I enter data then click on the tab for the page containing the
subform.
3. Mainform_ BeforeUpdate.
4. Subform_OnCurrent.
5. Subform_BeforeUpdate.
This gives the validation error because I've not had a chance to enter
anything. I say OK to cancel the save.
6. TabControl_Change.
Basically my questions are:-
Why does the subform save at this point?
Why is it dirty anyway when the code to change the field isn't
actioned until after the save?
Is there any way to stop the save of the subform record?
All I want to do is to have the mainform record saved and the subform
open for input, but with that one field pre-set. It doesn't sound like
rocket science but I'm well stumped.
Any help would be very greatly received.
Thanks.
Joan Edington