I
iTISTIC
I have one query (SQL below) that works fine on it's own:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT tblCustomers.account_number, tblCustomers.last_name,
tblCustomers.city, tblCustomers.zip_code,
qryCustomer_NextFilterChange.MinOfservice_call_date AS [Next Change],
tblCustomerEquipment_Crosstab.Cond,
tblCustomerEquipment_Crosstab.[R/O],
tblCustomerEquipment_Crosstab.USUV, tblCustomerEquipment_Crosstab.WHUV,
tblCustomers.service_only
FROM (tblCustomers INNER JOIN qryCustomer_NextFilterChange ON
tblCustomers.account_number =
qryCustomer_NextFilterChange.account_number) LEFT JOIN
tblCustomerEquipment_Crosstab ON tblCustomers.account_number =
tblCustomerEquipment_Crosstab.account_number
WHERE (((qryCustomer_NextFilterChange.MinOfservice_call_date) Between
[Start Date] And [End Date]))
ORDER BY tblCustomers.account_number;
I have another query which will return a result set of all customer
account numbers, and ONE of the customer's phone numbers (SQL below):
SELECT tblCustomers.account_number, (SELECT TOP 1 phone_number FROM
tblCustomerPhoneNumbers WHERE account_number =
tblCustomers.account_number) AS [Phone Number]
FROM tblCustomers;
Both of these queries execute without an error on their own. When I
modify the first query to join on the second and show the customer's
phone number, I receive the error "The Microsoft Jet database engine
does not recognize 'tblCustomers.account_number' as a valid field name
or expression." I have pasted the SQL code below of query #1 modified
with the join to query #2:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT tblCustomers.account_number, tblCustomers.last_name,
tblCustomers.city, tblCustomers.zip_code,
qryCustomers_OnePhoneNumber.[Phone Number],
qryCustomer_NextFilterChange.MinOfservice_call_date AS [Next Change],
tblCustomerEquipment_Crosstab.Cond,
tblCustomerEquipment_Crosstab.[R/O],
tblCustomerEquipment_Crosstab.USUV, tblCustomerEquipment_Crosstab.WHUV,
tblCustomers.service_only
FROM ((tblCustomers INNER JOIN qryCustomer_NextFilterChange ON
tblCustomers.account_number =
qryCustomer_NextFilterChange.account_number) LEFT JOIN
tblCustomerEquipment_Crosstab ON tblCustomers.account_number =
tblCustomerEquipment_Crosstab.account_number) LEFT JOIN
qryCustomers_OnePhoneNumber ON tblCustomers.account_number =
qryCustomers_OnePhoneNumber.account_number
WHERE (((qryCustomer_NextFilterChange.MinOfservice_call_date) Between
[Start Date] And [End Date]))
GROUP BY qryCustomers_OnePhoneNumber.[Phone Number]
ORDER BY tblCustomers.account_number;
Anyone have any idea why this may be? I have tried putting the
sub-query for the phone number directly into query #1, joining on query
#2, etc. all with the same result (error message referenced above). I
use this same sub-query in other queries in the same database and it
works fine. The only difference in these other queries is that there is
no crosstab involved. I am assuming that is part of the problem.
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT tblCustomers.account_number, tblCustomers.last_name,
tblCustomers.city, tblCustomers.zip_code,
qryCustomer_NextFilterChange.MinOfservice_call_date AS [Next Change],
tblCustomerEquipment_Crosstab.Cond,
tblCustomerEquipment_Crosstab.[R/O],
tblCustomerEquipment_Crosstab.USUV, tblCustomerEquipment_Crosstab.WHUV,
tblCustomers.service_only
FROM (tblCustomers INNER JOIN qryCustomer_NextFilterChange ON
tblCustomers.account_number =
qryCustomer_NextFilterChange.account_number) LEFT JOIN
tblCustomerEquipment_Crosstab ON tblCustomers.account_number =
tblCustomerEquipment_Crosstab.account_number
WHERE (((qryCustomer_NextFilterChange.MinOfservice_call_date) Between
[Start Date] And [End Date]))
ORDER BY tblCustomers.account_number;
I have another query which will return a result set of all customer
account numbers, and ONE of the customer's phone numbers (SQL below):
SELECT tblCustomers.account_number, (SELECT TOP 1 phone_number FROM
tblCustomerPhoneNumbers WHERE account_number =
tblCustomers.account_number) AS [Phone Number]
FROM tblCustomers;
Both of these queries execute without an error on their own. When I
modify the first query to join on the second and show the customer's
phone number, I receive the error "The Microsoft Jet database engine
does not recognize 'tblCustomers.account_number' as a valid field name
or expression." I have pasted the SQL code below of query #1 modified
with the join to query #2:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT tblCustomers.account_number, tblCustomers.last_name,
tblCustomers.city, tblCustomers.zip_code,
qryCustomers_OnePhoneNumber.[Phone Number],
qryCustomer_NextFilterChange.MinOfservice_call_date AS [Next Change],
tblCustomerEquipment_Crosstab.Cond,
tblCustomerEquipment_Crosstab.[R/O],
tblCustomerEquipment_Crosstab.USUV, tblCustomerEquipment_Crosstab.WHUV,
tblCustomers.service_only
FROM ((tblCustomers INNER JOIN qryCustomer_NextFilterChange ON
tblCustomers.account_number =
qryCustomer_NextFilterChange.account_number) LEFT JOIN
tblCustomerEquipment_Crosstab ON tblCustomers.account_number =
tblCustomerEquipment_Crosstab.account_number) LEFT JOIN
qryCustomers_OnePhoneNumber ON tblCustomers.account_number =
qryCustomers_OnePhoneNumber.account_number
WHERE (((qryCustomer_NextFilterChange.MinOfservice_call_date) Between
[Start Date] And [End Date]))
GROUP BY qryCustomers_OnePhoneNumber.[Phone Number]
ORDER BY tblCustomers.account_number;
Anyone have any idea why this may be? I have tried putting the
sub-query for the phone number directly into query #1, joining on query
#2, etc. all with the same result (error message referenced above). I
use this same sub-query in other queries in the same database and it
works fine. The only difference in these other queries is that there is
no crosstab involved. I am assuming that is part of the problem.