Is there an easy way to prevent a subform from loading at the same time as the main form loads ?
I'm trying to implement the following process ( may or may not work well with Access ).
- user opens a form. There is no data, just a couple of unbound controls and a subform which is initially invisible
- user sets a few options (e.g. checkboxes), and then clicks on a command button on the form
- the command button starts some lengthy processing in an Sql 2000 database ( stored procedure )
- if the stored proc completes successfully, it returns a short result set (statistics)
- now, the subform becomes visible, and displays the recordset obtained from the execution of the stored proc
So far, I had no luck in fully implementing this. Trouble is, the subform wants to display some data immediately when the main form opens. As a workaround, I used a separate Form instead of the subform, but then I'm running into communication problems between the two forms.
Another workaround I've tried was to have some dummy data to satisfy the subform during the initial load. I created a view which returns a single constant row, e.g. "Error during processing". At design time, my subform displays this data. At run-time, if the stored proc returns prematurely, then it produces no result set, so I stay with the design-time content of the subform.
All nice, but there is probably a simpler way for preventing the subform from loading upfront.
Any ideas ? Is this scenario more VB-specific than Access ?
this makes sense and I will try it. Does "fsubBlank" need to exist as a separate form object in its own right ? I assume it must exist, because the only way I know to create a subform is to drag a an existing form into the design space of the parent.
Later, when I set the sourceobject to the name of the real form, does this trigger an immediate Load ? I hope not, because I'd like to assign my own (compatible) recordset to it, or make it reload.
Capitol Hill - Capital City
Capitol Theatre - Capital Punishment
yes - fsubblank needs to be a "real" form (it's a great place to post a logo or a copyright notice)
yes - when you .sourceobject to the live form it will expect to find it's records
if this doesn't fit with your game plan, you could consider defining your own (compatible) recordset in SQL, saving it as a querydef, and using that querydef as the recordsource of your live form. that way you can set up your recordset whilst fsubblank is showing.