How to Reference Tabbed Subforms

painterz

Registered User.
Local time
Today, 10:01
Joined
Nov 29, 2012
Messages
182
Hello All,

I'm new to the tab control. I've placed a tabbed control on my main form and populated it with my subform (which also contains subforms). Now my OnLoad for my main form isn't working. I've looked online on how to reference the subform and it seems simple

subformname.sourceobject

Evidently, I don't know what a sourceobject is because my changes haven't worked.

This is what worked before I added the tab control:

Forms![Neighbors subform]![PKRelationship] = 3

When changing it to

Me.[Neighbors subform].PKRelationship = 3

I get an error message "Neighborhood Database can't find the field "|" referred to in your expression." when my form loads. Any suggestions?

Thanks
 
So from the main form you are referencing a control on a subform? If so, it has nothing to do with the tab control. It should be something like...

Code:
Me.[Neighbors subform].Form.[control name]

If you are referencing this control from somewhere else, it would be more like this:

Code:
Forms![parent form name].[Neighbors subform].Form.[control name]
 
Thank you, both, for your replies. Unfortunately, nothing worked. I'm still getting the same error message. This all worked fine until I added the tab control.
 
.. Now my OnLoad for my main form isn't working.
Why not have it in OnLoad event for the sub form?
Else post a stripped down version of your database with some sample data in it, zip it.
 
I finally figured it out. I placed my subform in a subform container on the tab control so I needed to reference the subform container not the subform. YAY!!! It works!
 

Users who are viewing this thread

Back
Top Bottom