sandracwalsh
New member
- Local time
- Today, 12:13
- Joined
- Nov 18, 2011
- Messages
- 4
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_ActivityDetails 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_ActivityDetails sub-form has a tab control in which I have a sub-sub form named f_OtherFirmContacts on one of the pages
f_MainTripForm
-> f_ActivityDetails joined on Trip_ID
->-> f_OtherFirmContacts joined on Activity_ID
In f_OtherFirmContacts I have a dropdown named SelectContact_DD that should select only the contacts that have a Company_ID = to the Listing_ID stored in the Company_DD drop-down in f_ActivityDetails.
I have this code for the SelectContact_DD drop down:
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 open the form, I get a request to Enter Parameter Value.
When I create an unbound field in f_Contacts with the Control Source
=[Forms]![f_MainTripForm]![f_ActivityDetails].[Form]![Company_DD]
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_ActivityDetails 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_ActivityDetails sub-form has a tab control in which I have a sub-sub form named f_OtherFirmContacts on one of the pages
f_MainTripForm
-> f_ActivityDetails joined on Trip_ID
->-> f_OtherFirmContacts joined on Activity_ID
In f_OtherFirmContacts I have a dropdown named SelectContact_DD that should select only the contacts that have a Company_ID = to the Listing_ID stored in the Company_DD drop-down in f_ActivityDetails.
I have this code for the SelectContact_DD drop down:
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 open the form, I get a request to Enter Parameter Value.
When I create an unbound field in f_Contacts with the Control Source
=[Forms]![f_MainTripForm]![f_ActivityDetails].[Form]![Company_DD]
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
Last edited: