Referencing subform

J

Jess

I have a form with many subforms

How can I reference the subform containing a control having the focus?
I can easily reference the main form with the statement screen.activeform.
Is there a statement similar to screen.activesubform? If so, that is what I
am looking for.

Basically, whenever a control in a subform gets the focus, I need to access
the recordset the subform is based on. All the get_focus events are caught in
a class module that needs to know the active form, subform, and the control.

Thanks
 
D

Dale_Fye via AccessMonster.com

Jess,

I use some code that looks similar to:

Dim frm as form

Set frm = Screen.ActiveForm
While frm.ActiveControl.ControlType = acSubForm
set frm = frm.ActiveControl.Form
Loop
set ctrl = frm.ActiveControl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top