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!

Variables and Sub Forms

Status
Not open for further replies.

Denz

Technical User
Oct 29, 2001
33
0
0
GB


I have a Main Form with 3 Combo Boxes and a Sub Form, when selections are made from the 3 Combos, the Sub Form updates, and fills in some Text Boxes. Once these Text boxes are filled out in the Sub Form, I want the 3 combos to fill 3 Global Variables, and one of the Text Boxes in the Sub Form to fill out the final Global Variable.

However, I seem to be having trouble filling out the Varible form the Sub form, the 3 combos are easy, simply;

StrTEST = cboTEST

But I don’t seem to be able to the reference the Sub Form Controls from the Code in the main Form.

So when I do something like;

StrANOther = Frm_SubForm.txtSupport

I get an error “Method or Data Member not found”

Is there a nice neat way of picking the Variable from this text box? I’ve even tried picking up the Variable from the text box update event, but it still wont pick it up… may I’m just making a stupid mistake!

Thanks for your help.

Dave
 
Hi

I'm not sure if you've copied your code verbatim there, but if you have your problem is your syntax.

The error message you are receiving is because your code is trying to call a method 'txtSupport' of your subform, which of course doesn't exist.

To reference a control (say TxtMyControl) on a subform (MySubform) within a main form (MyMainform) you would need:

Forms!MyMainform!MySubform.form!TxtMyControl.

Obviously when referencing the subform from the main form you could omit the 'Forms!MyMainform' and simply reference Me.


Hope this helps

Cheers

Clare
 
ah cool.. that worked... i knew it was something simple.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top