If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Need help getting query to reference a field in a subform
I am trying to run a query using a specific field in a subform as the
criteria. The query is displaying one combo box from the Form, as well as several fields from its own subform. My Form name is: FormGrantManagement My Subform name is: TableMOA subform My Subform's subform is: TableCostReports The field in the subform I want to reference is: MOAID I have found other help topics that lead me to think that a criteria along the lines of [Forms]![FormGrantManagement]![TableMOA subform]! [Form]![MOAID] is what I need to use, and I have tried multiple variations of this but without success. When I run this query in my form it prompts me with a parameter query displaying my criteria. If I type in an actual MOAID number, then the query works, if I click "Okay" without typing anything in the parameter query I get a query without any data. Any ideas? Thanks! Mike |
#2
|
|||
|
|||
Need help getting query to reference a field in a subform
Mike Daniska wrote:
I am trying to run a query using a specific field in a subform as the criteria. The query is displaying one combo box from the Form, as well as several fields from its own subform. My Form name is: FormGrantManagement My Subform name is: TableMOA subform My Subform's subform is: TableCostReports The field in the subform I want to reference is: MOAID I have found other help topics that lead me to think that a criteria along the lines of [Forms]![FormGrantManagement]![TableMOA subform]! [Form]![MOAID] is what I need to use, and I have tried multiple variations of this but without success. When I run this query in my form it prompts me with a parameter query displaying my criteria. If I type in an actual MOAID number, then the query works, Form is a **property** of subform controls, so that should be: Forms!FormGrantManagement![TableMOA subform].Form!MOAID If that still generates a prompt, check the spelling of each name carefully. -- Marsh MVP [MS Access] |
#3
|
|||
|
|||
Need help getting query to reference a field in a subform
Mike,
You refer to two subforms. Is [TableCostReports] a subform within [tableMOA subform]? Which of these subforms contains the MOAID field? Also, you need to use the name of the subform control, not the name of the object that is the subform. So it might look like: Forms!FormGrantManagement![TableMOA subform].form.MOAID as Marshall stated, but if MOAID is on the [TableCostReports] subform, then it might look like: Forms!FormGrantManagement![TableMOA subform].form.[tableCostReports].form.MOAID the general syntax should look like: Forms!MainFormName!subformControlName.form.control name or Forms!MainFormName!sub1CtrlName.form.sub2CtrlName. form.controlname ---- HTH Dale "Mike Daniska" wrote: I am trying to run a query using a specific field in a subform as the criteria. The query is displaying one combo box from the Form, as well as several fields from its own subform. My Form name is: FormGrantManagement My Subform name is: TableMOA subform My Subform's subform is: TableCostReports The field in the subform I want to reference is: MOAID I have found other help topics that lead me to think that a criteria along the lines of [Forms]![FormGrantManagement]![TableMOA subform]! [Form]![MOAID] is what I need to use, and I have tried multiple variations of this but without success. When I run this query in my form it prompts me with a parameter query displaying my criteria. If I type in an actual MOAID number, then the query works, if I click "Okay" without typing anything in the parameter query I get a query without any data. Any ideas? Thanks! Mike . |
Thread Tools | |
Display Modes | |
|
|