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

enter event and subform referencing

Status
Not open for further replies.

Extinct

Programmer
May 14, 2002
40
BE
I have a form with 2 subforms in datasheet view

The recordsource of the 2nd subform is changed in the enter event of the first field of the first subform like so

Forms!frmclocks!Sources.Form.RecordSource = "SELECT tblsources.SWITCH, tblsources.LCOS, tblsources.LTG, tblsources.DIU, tblsources.TGNO FROM tblsources WHERE (((tblsources.SWITCH)='" & Me!Switch & "'))"

This is working perfectly once the form is loaded. I can use the arrows to jump from record to recod and the 2nd subform will be updated accordingly

When I first open the form, the enter event of the first subform triggers but can not reference the 2nd subform and I get a 2455 error.

Forms!frmclocks!Sources can be referenced
Forms!frmclocks!Sources.Form can not be referenced

So is there a way to check if the subform's form is loaded or not or if there is a way to change the order in which subforms are loaded?

I tried setting the tabstop property to no but then I can not navigate the datasheet anymore.

Any help is welcome.
 
Ok I just found a solution myself.

I have set the visible proporty of the subform to false.
In the enter event I check if the subform is visible and set it to true.

Any other solution are always welcome.
 
Extinct,
If I understand what you are doing it sounds like you have two synchronized sub forms. You can do this a little cleaner, by hiding the text box "txtBxlinkSwitch" on the main form. Now link the second subform to this text box.

On the on current event of subform 1

me.parent.txtBxLinkSwitch.value = me.Switch
Now access does all the work for you.
 
Another reason that this is useful, is that nested subforms (besides ugly and confusing) have the following limitations:

1. Can only nest three levels
2. You can not nest continous forms.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top