Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if a subform has loaded yet? 1

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
I am using MS Access 2003.
I have a form that has 3 subforms.
From top to bottom, I will call my subforms:
subform1
subform2
subform3

On the subform2 OnCurrent event, I try to load the RecordSource of subform3. When I first bring up the form, I always get an error. If I click Ok through the error, it doesn't happen again, until I close the form and then open it back up.

The error message I am getting is: "You entered an expression that has an invalid reference to the property Form/Report"

Here is the line it is quiting on
Code:
Forms![frmWorkOrder]![frmSubWOTasksAssigned].Form.RecordSource = strSQL

I put a break on that line and the first time the form is loading, I get the error message. I try to get the value from the immediate window and I get the same message. I click OK and then it comes back to the line a second time. It is successful the second time it runs.

Is there a way to tell if the subforms have loaded yet?

 
Howdy Remou,

I am not sure what your comment means.

I am not sure if you meant on the load event of subform2, somehow check if subform3 exists? Not sure how to check to see if subform3 exists?

I have to have whenever the user clicks through subform2, that subform3 recordsource changes. subform3 Link Master Fields is pointing to a hidden field on the main form, but it has to update its values also based on another field value in subform2.

Thanks
 
It may be possible to use the load event of subform 3 to set a variable to indicate that the form has loaded.
 
Howdy Remou,

I will try that and get back to you.
 
Howdy Remou,

That worked perfectly.
Simple to do, but very effective.

Thanks again and star to you,
ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top