Error on Tab Control

darreno

Registered User.
Local time
Today, 10:59
Joined
Jun 16, 2007
Messages
54
I have the following line on my subform [frmFixedsubform] referring to the main form [frmFixed] and it is working fine.

[Forms]![frmFixed]![FYE]

I then put the main form to a tab control in a new form [frmDeal] and changed the syntax to the following but it didn’t work.

[Forms]![frmDeal]![frmFixed]![FYE]

I looked at http://www.mvps.org/access/forms/frm0031.htm and tried other syntax like [Me].[frmDeal].[frmFixed].[FYE] but can’t get it to work.

Help!!
 
The syntax is:
Forms.MainFormName.SubFormControlName.FORM.ControlName
...using your values of course. Remember that a SubFormControl does not need to be named the same as the form it is displaying. And do not forget the keyword FORM toward the end of the syntax.
 
I am still having trouble getting it to work after changing it to

[forms].[frmDeal].[frmfixed].[form].[FYE]
or
[forms].[frmDeal].[FYE].[form].[FYE]

I am stumped!
 
If I read it correctly FYE is a control on the form frmFixed, correct? If so the syntax would be (if being used in the criteria of a query or control source):

If in the criteria of a query:

[Forms]![frmDeal]![Form]![frmFixed]![Form]![FYE]

If in a control source:

[Forms]![frmDeal]![frmFixed]![Form]![FYE]


If used in VBA code:

Forms!frmDeal.frmFixed.Form.FYE

Or

Forms("frmDeal").Controls("frmFixed").Form.Controls("FYE")
 
Alternatively, in wherever you may need the criteria, you can right-click the textbox and click "Build..." which will bring up the Expression Builder and select Forms -> Loaded Forms -> Main Forms -> Subform, and voila you get the correct syntax. :)
 
Bob:

Its in a criteria of a query and I replaced it with:

[Forms]![frmDeal]![Form]![frmFixed]![Form]![FYE]

It still didn't work. I have attached the sample for your review. Please advice what went wrong. Thanks.
 

Attachments

Well, it would appear that you didn't realize that you have to use the name of the subform CONTAINER (the control housing the subform). And, both of your subform containers are named differently than their subform. Also, you need to reference the CONTROL name, not the field name.

So, it SHOULD be:

[Forms]![frmDeal]![Trades]![Form]![cboFYE]
 
Where in your db have you used the syntax to which you are referring?
 
Bob:

I changed it to:

[Forms]![frmDeal]![Trades]![Form]![cboFYE]

but it still didn't work. And, I am now more confused than ever - where did you find [Trades] in the db?
 
Bob:

I changed it to:

[Forms]![frmDeal]![Trades]![Form]![cboFYE]

but it still didn't work. And, I am now more confused than ever - where did you find [Trades] in the db?

That's the name of the subform container control on the main form.
 
Aha...found it. Geez...I didn't realize the name of the form changed when I paste it to the main form. Anyway, I rename it to frmFixed with the following syntax:

[Forms]![frmDeal]![frmFixed]![Form]![cboFYE]

And, its working now! Thank you very much!

On another related issue - when I select a Fiscal Year, the Begin Date combo pulls up the correct periods. However, when I change to a different Fiscal Year, the Begin Date periods did not change accordingly. Please see attached db. Thank you for your help.
 

Attachments

Have you tried to run the db you posted? There are more problems than you have suggested.
 

Users who are viewing this thread

Back
Top Bottom