G
Guest
hopefully this won't be too generic. not really sure how to explain it.
i have a fairly simple form with a subform. the subform recordsource is
a query that's updated dynamically when a user selects an item from a
list in the main form.
when i first created the form/subform i was getting some errors because
it appears that the subform was loading first and since there was no
user interaction the query wasn't correct and there was no data to show
in the subform.
i 'fixed' this by creating a completely empty form and used that as the
initial sourceobject for the subform. when the user selects an item in
the main form, i change the subform's sourceobject to the 'real' form
which shows the data. when the main form is closed i reset the
subform's sourceobject back to the empty form.
it seemed to work fine until seemingly randomly i get the same old
error pop up. when i open the main form in design view, the non-empty
form is already loaded into the subform... my code to reset it back was
apparently ignored.
i've added everything i can think of to the onload and onunload events
in the main and sub forms to unload the subform and/or set its
sourceobject to the blank form but nothing seems to stick.
the only way to fix it is to open the form in design mode, select the
subform object, and manually delete the sourceobject text from the
properties window. when i close it, and reopen it, it's fine.
why can't i do the same thing via vba successfully? has anyone ever had
a similar issue? something seems to be freezing the state so my changes
are saved. thanks.
i have a fairly simple form with a subform. the subform recordsource is
a query that's updated dynamically when a user selects an item from a
list in the main form.
when i first created the form/subform i was getting some errors because
it appears that the subform was loading first and since there was no
user interaction the query wasn't correct and there was no data to show
in the subform.
i 'fixed' this by creating a completely empty form and used that as the
initial sourceobject for the subform. when the user selects an item in
the main form, i change the subform's sourceobject to the 'real' form
which shows the data. when the main form is closed i reset the
subform's sourceobject back to the empty form.
it seemed to work fine until seemingly randomly i get the same old
error pop up. when i open the main form in design view, the non-empty
form is already loaded into the subform... my code to reset it back was
apparently ignored.
i've added everything i can think of to the onload and onunload events
in the main and sub forms to unload the subform and/or set its
sourceobject to the blank form but nothing seems to stick.
the only way to fix it is to open the form in design mode, select the
subform object, and manually delete the sourceobject text from the
properties window. when i close it, and reopen it, it's fine.
why can't i do the same thing via vba successfully? has anyone ever had
a similar issue? something seems to be freezing the state so my changes
are saved. thanks.