def subform as form object

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings,
Adapting ya'lls FrmSampl - (Form_subSync (Code)), in Form_Current(),
may one say,
Set F = Forms(strFormName)
Set rs = F.Recordset.Clone
where
strFormName = "fsubIffy" is a subform?

Hoping that is a valid ?, what if the synced source appeared in fsubIffy in a combobox instead of a plain txtbox, would it become current choice by itself?
 
Jim Shores said:
Greetings,
Adapting ya'lls FrmSampl - (Form_subSync (Code)), in Form_Current(),
may one say,
Set F = Forms(strFormName)
Set rs = F.Recordset.Clone
where
strFormName = "fsubIffy" is a subform?

A subform is not a member of the Forms collection, so the reference
you've written won't work. You can still get to the subform's
recordsetclone, but you have to go in by way of the subform control on
the main form. You need a reference along these lines:

Set F = Forms("MainFormName")!SubformControlName.Form

or

Set F = Forms("MainFormName").Controls(SubformControlName).Form

The catch here is that "fsubIffy" may or may not be the name of that
subform control. It's the name of the subform control's Source Object,
but is it the name of the control that displays the source object? That
depends on how the subform control was created and whether you renamed
it since then. If the variable strFormName *does* contain the name of
the subform control, then you can use

Set F = Forms("MainFormName").Controls(strFormName).Form
Hoping that is a valid ?, what if the synced source appeared in
fsubIffy in a combobox instead of a plain txtbox, would it become
current choice by itself?

I have no idea what you're talking about here; sorry.
 
Jim said:
Adapting ya'lls FrmSampl - (Form_subSync (Code)), in Form_Current(),
may one say,
Set F = Forms(strFormName)
Set rs = F.Recordset.Clone
where
strFormName = "fsubIffy" is a subform?


No, subforms are not members of the Forms collection.

The form object displayed in a subform control is only
available throungh the control.

Set F = Me.Controls("subformcontrol").Form

Note that the name of the subformcontrol may be different
from the name of the form it is displaying.

Hoping that is a valid ?, what if the synced source appeared in fsubIffy in a combobox instead of a plain txtbox, would it become current choice by itself?

I don't understand what you're asking here.
 
Back
Top