Criteria reference to a column on a form (subform)

  • Thread starter Thread starter George L
  • Start date Start date
G

George L

Hi - newbie question.

I am attempting to use a column on my form as a retrieval argument in a
query. In the query, I enter the following criteria:

[Forms]![frmEditDCNLineItem]![cboFiscalYear]

Where the form name is: frmEditDCNLineItem
And the column name on form to use as a parameter is: cboFiscalYear

As a side note, the query is executed in a subform and the cboFiscalYear
column is in the top form. Is this syntax correct? Any thoughts or
suggestions on how to do this differently if this is not the best way to do
it would be greatly appreciated.

TIA

- George.
 
I am attempting to use a column on my form as a retrieval argument in a
query. In the query, I enter the following criteria:

[Forms]![frmEditDCNLineItem]![cboFiscalYear]

Where the form name is: frmEditDCNLineItem
And the column name on form to use as a parameter is: cboFiscalYear

As a side note, the query is executed in a subform and the cboFiscalYear
column is in the top form. Is this syntax correct? Any thoughts or
suggestions on how to do this differently if this is not the best way to do
it would be greatly appreciated.
http://www.mvps.org/access/forms/frm0031.htm
This is an excellent explanation of how to reference forms and subforms.
Marc
 
George,

It seems your tables are not set up correctly if you have to control the subform
like this!

Your tables should look like:

TblCustomer
CustomerID
CustomerName
etc

TblOrders
OrderID
FiscalYear
CustomerID
etc

TblOrderDetails
OrderDetailID
OrderID
LineItem
Quantity
Price

You then create a form/subform based on TblOrders and TblOrderDetails. The
OrderDetails will then be automatically associated with the fiscal year you
enter in the main form.
 
This link is great - thanks!

Here is the code that worked:

[Forms]![frmEditDCNLineItem]![frmEditDCNLineItem_Sub]![cboFiscalYear]


Marc said:
I am attempting to use a column on my form as a retrieval argument in a
query. In the query, I enter the following criteria:

[Forms]![frmEditDCNLineItem]![cboFiscalYear]

Where the form name is: frmEditDCNLineItem
And the column name on form to use as a parameter is: cboFiscalYear

As a side note, the query is executed in a subform and the cboFiscalYear
column is in the top form. Is this syntax correct? Any thoughts or
suggestions on how to do this differently if this is not the best way to do
it would be greatly appreciated.
http://www.mvps.org/access/forms/frm0031.htm
This is an excellent explanation of how to reference forms and subforms.
Marc
 
Back
Top