I am using Access 2003 and SQL Server 2005. Database is broken up into BE/FE.
I have a query that I have simplified in order to find the cause of my problem. I am trying to return two fields from a table that each have as their criteria a subquery which will exclude certain values.
SELECT RCUST.customernumber, RCUST.countrycode
FROM RCUST
WHERE (((RCUST.customernumber) Not In
(SELECT tblExclusions.ValueToExclude
FROM tblExclusions
WHERE (((tblExclusions.ExclusionType)="Customer")))
AND
((RCUST.countrycode) Not In
(SELECT tblExclusions.ValueToExclude
FROM tblExclusions
WHERE (((tblExclusions.ExclusionType)="CountryCode"));
)));
This query causes Access to crash - Access has encountered an error and needs to close.....
I can run the query with either subquery as a criteria, but when I include both subqueries as criteria, Access crashes. Also, I can copy tblExclusions and paste as a local table and then the query runs fine !!!!??????
I started a brand new database and linked the two tables, then created the query in that database and had the same exact problem. So, I don't think it's a corruption, it's just that Access does not like this query.
Can anyone tell me why Access does not like this query and why it works correctly when tblExclusions is a local table instead of a linked SQL Server table?
Thanks.
I have a query that I have simplified in order to find the cause of my problem. I am trying to return two fields from a table that each have as their criteria a subquery which will exclude certain values.
SELECT RCUST.customernumber, RCUST.countrycode
FROM RCUST
WHERE (((RCUST.customernumber) Not In
(SELECT tblExclusions.ValueToExclude
FROM tblExclusions
WHERE (((tblExclusions.ExclusionType)="Customer")))
AND
((RCUST.countrycode) Not In
(SELECT tblExclusions.ValueToExclude
FROM tblExclusions
WHERE (((tblExclusions.ExclusionType)="CountryCode"));
)));
This query causes Access to crash - Access has encountered an error and needs to close.....
I can run the query with either subquery as a criteria, but when I include both subqueries as criteria, Access crashes. Also, I can copy tblExclusions and paste as a local table and then the query runs fine !!!!??????
I started a brand new database and linked the two tables, then created the query in that database and had the same exact problem. So, I don't think it's a corruption, it's just that Access does not like this query.
Can anyone tell me why Access does not like this query and why it works correctly when tblExclusions is a local table instead of a linked SQL Server table?
Thanks.