Sub-form controls

G

Guest

I have a master form (frmMaster) with two sub-forms (sfrmDetail1) and
(sfrmDetail2). Both sub-forms are contained in sub-form controls using the
same names as the sub forms.
I would like to populate a textbox (txtLicense) on sfrmDetail2 with the
contents of a textbox (txtOriginalID) on sfrmDetail1. I am having a problems
trying to refer to the appropriate controls. I have tried:
(forms.frmmaster.sfrmDetail2.form!txtlicense =
forms.frmMaster.sfrmDetail2.form!txtOriginalID). I get an error the the
object doesn't support the method or property.
Any help in how to refer to these controls would be appreciated.
Thanks
AJ
 
D

Dirk Goldgar

AJ said:
I have a master form (frmMaster) with two sub-forms (sfrmDetail1) and
(sfrmDetail2). Both sub-forms are contained in sub-form controls
using the same names as the sub forms.
I would like to populate a textbox (txtLicense) on sfrmDetail2 with
the contents of a textbox (txtOriginalID) on sfrmDetail1. I am
having a problems trying to refer to the appropriate controls. I
have tried: (forms.frmmaster.sfrmDetail2.form!txtlicense =
forms.frmMaster.sfrmDetail2.form!txtOriginalID). I get an error the
the object doesn't support the method or property.
Any help in how to refer to these controls would be appreciated.

Is that the actual line of code you tried? I ask because you've
referred to sfrmDetail2 twice. Also, the reference "forms.frmmaster" is
not valid; the bang (!) should be used instead of the dot (.).

You should be able to write

With Forms!frmMaster
!sfrmDetail2.Form!txtLicense =
!sfrmDetail1.Form!txtOriginalID
End With

However, where and when -- in what event -- are you trying to do this?
In some events, the controls on both subforms might not be fully
instantiated.
 

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