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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform problem

Status
Not open for further replies.

filmgall

Programmer
Oct 19, 2009
7
0
0
US
I have a tab control with multiple subforms. My goal is to pass a current product ID from the main form into one of the subforms chosen by the user and have it display/populate all its fields based on the product ID when the event PID.GotFocus happens. I started with one subform and it worked. But then when I did another one, with almost identical code (simple DAO recordset query), this time when it's opened it doesn't do anything until I click on it then the data will display. If I don't click the subform only the PID is shown on it, that tells me the event PID.GotFocus did occur but the event handler didn't execute. Do you know why it behaves differently?
Furthermore if I pass the PID by hand in the subform load event and run PID.SetFocus then the data will display automatically next time I open it. But it won't work since the PID must be passed from the main form.
 
filmgall,
Sounds like overkill, can you use the Parent/Child relationship between the main form and sub-forms to handle the filtering?

Just a thought,
CMP
 
I agree with CMP, it sounds like you have a natural "parent Child" relationship. Can you explain more the different subforms and how they are used?
 
Ok I guess my question should be this: how do I catch the event when I switch from the main form to its subform in a tab control. Other than SetFocus I wasn't able to do that. I tried Tabcontrol.Change event but how do I let the subform know it has the current tab so it can start displaying the data based on the ProductID value passed from the main form? The onload procedure for the subform would not work either since at its load event the ProductID hasn't been generated yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top