Hello -
I am going crazy trying to sort out what should be a very straightforward reference to a field on a sub-form. There is an error in the WHERE clause of my query but I can't figure it out.
The hierarchy of my data is as follows:
Trips -> Activities -> Contacts
I have a main form called f_MainTripForm. On this Main form I have a sub-form called f_ActivityDetai ls where the user selects the Company they are visiting from a drop-down named Company_DD with a control source of Company_Listing _ID
The f_ActivityDetai ls sub-form has a tab control in which I have a sub-sub form named f_OtherFirmCont acts on one of the pages
f_MainTripForm
-> f_ActivityDetai ls joined on Trip_ID
->-> f_OtherFirmCont acts joined on Activity_ID
In f_OtherFirmCont acts I have a dropdown named SelectContact_D D that should select only the contacts that have a Company_ID = to the Listing_ID stored in the Company_DD drop-down in f_ActivityDetai ls.
I have this code for the SelectContact_D D drop down:
When I open the form, I get a request to Enter Parameter Value.
When I create an unbound field in f_Contacts with the Control Source
I get a #Name error.
When I manually enter the COMPANY_ID in the Parameter Value request, all works fine.
Thanks for any suggestions - I am sure it is something simple to do with the syntax of the WHERE clause.
Sandra
I am going crazy trying to sort out what should be a very straightforward reference to a field on a sub-form. There is an error in the WHERE clause of my query but I can't figure it out.
The hierarchy of my data is as follows:
Trips -> Activities -> Contacts
I have a main form called f_MainTripForm. On this Main form I have a sub-form called f_ActivityDetai ls where the user selects the Company they are visiting from a drop-down named Company_DD with a control source of Company_Listing _ID
The f_ActivityDetai ls sub-form has a tab control in which I have a sub-sub form named f_OtherFirmCont acts on one of the pages
f_MainTripForm
-> f_ActivityDetai ls joined on Trip_ID
->-> f_OtherFirmCont acts joined on Activity_ID
In f_OtherFirmCont acts I have a dropdown named SelectContact_D D that should select only the contacts that have a Company_ID = to the Listing_ID stored in the Company_DD drop-down in f_ActivityDetai ls.
I have this code for the SelectContact_D D drop down:
Code:
SELECT q_ContactsAtACompany.Cont_LISTING_ID, q_ContactsAtACompany.DISPLAY_NM, q_ContactsAtACompany.POSITION_NM, q_ContactsAtACompany.COMPANY_ID FROM q_ContactsAtACompany WHERE (((q_ContactsAtACompany.COMPANY_ID)=[Forms]![f_MainTripForm]![f_ActivityDetails].[Form]![Company_DD])) ORDER BY q_ContactsAtACompany.DISPLAY_NM;
When I create an unbound field in f_Contacts with the Control Source
Code:
=[Forms]![f_MainTripForm]![f_ActivityDetails].[Form]![Company_DD]
When I manually enter the COMPANY_ID in the Parameter Value request, all works fine.
Thanks for any suggestions - I am sure it is something simple to do with the syntax of the WHERE clause.
Sandra
Comment