I am constructing a VB 6.0/Access application, and I have a main form which contains a subform in a datasheet view. I need to dynamically set the recordsource of the subform at run-time. I am doing this by performing the following code in the load event of the main form:

Me!Subform_Name.Form.RecordSource = QueryString

Unfortunately, I get the following error which occurs sporatically:

The expression that you have entered refers to an object that is closed or does not exist.

I am assuming that the subform is opened at the same time as the main form is loaded. Is this a timing issue? Is there any way I can guarantee the subform object will exist when the main form is loaded?

Thanks!