Solved

"query is too complex " error MS ODBC access driver

Posted on 2001-07-23
12
501 Views
Last Modified: 2008-02-01
how do i get around this error?
the query is built with too many boolean expressions...
0
Comment
Question by:nvivas
  • 3
  • 2
  • 2
  • +3
12 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
0
 
LVL 38

Expert Comment

by:PaulHews
Comment Utility
The only way around this is to redesign your query.  If you post it here we might be able to help.
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Hi Paul,

Yes, I do believe that that was Microsoft's conclusion also.

:)
0
 
LVL 38

Expert Comment

by:PaulHews
Comment Utility
>Yes, I do believe that that was Microsoft's conclusion also.

Dave, if you read my comment you would have seen that it was an offer to help.  Not a contradiction of what you or MS said.  I didn't need to read those links to know that the query needs redesigning when you get that error.

0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
No problems Paul...  I was just as surprised as you that MS's answer was "redesign your query"...  Funny, that's all

Cheers!
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
And what is this query?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:clangl
Comment Utility
is it Access, SQL Server...???
0
 
LVL 4

Expert Comment

by:vindevogel
Comment Utility
Divide your queries into subqueries
Like

T1 Join T2 Join T3 Join T4

becomes
Q1 : T1 Join T2
Q2 : T3 Join T3
FQ : Q1 Join Q2
0
 

Author Comment

by:nvivas
Comment Utility
join is not an option because it's limited too...here's the query:
SELECT PKID, Name FROM tabArtigos WHERE tabArtigos.Pkid>0  AND ( tabArtigos.grp0=4200 OR  tabArtigos.grp0=9999 OR  tabArtigos.grp0=9500 OR  tabArtigos.grp0=1600 OR  tabArtigos.grp0=1200) AND ( tabArtigos.grp0<>3000 AND  tabArtigos.grp0<>2400 AND  tabArtigos.grp0<>1100 AND  tabArtigos.grp0<>4600 AND  tabArtigos.grp0<>3200 AND  tabArtigos.grp0<>1300 AND  tabArtigos.grp0<>1500 AND  tabArtigos.grp0<>4700 AND  tabArtigos.grp0<>120 AND  tabArtigos.grp0<>8700 AND  tabArtigos.grp0<>4800 AND  tabArtigos.grp0<>1900 AND  tabArtigos.grp0<>9200 AND  tabArtigos.grp0<>8400 AND  tabArtigos.grp0<>8200 AND  tabArtigos.grp0<>8600 AND  tabArtigos.grp0<>4000 AND  tabArtigos.grp0<>300 AND  tabArtigos.grp0<>2300 AND  tabArtigos.grp0<>200 AND  tabArtigos.grp0<>3500 AND  tabArtigos.grp0<>110 AND  tabArtigos.grp0<>8000 AND  tabArtigos.grp0<>0 AND  tabArtigos.grp0<>3600 AND  tabArtigos.grp0<>500 AND  tabArtigos.grp0<>4900 AND  tabArtigos.grp0<>115 AND  tabArtigos.grp0<>9300 AND  tabArtigos.grp0<>8100 AND  tabArtigos.grp0<>2100 AND  ta
bArtigos.grp0<>102 AND  tabArtigos.grp0<>100 AND  tabArtigos.grp0<>104 AND  tabArtigos.grp0<>111 AND  tabArtigos.grp0<>112 AND  tabArtigos.grp0<>106 AND  tabArtigos.grp0<>103 AND  tabArtigos.grp0<>113 AND  tabArtigos.grp0<>130 AND  tabArtigos.grp0<>600 AND  tabArtigos.grp0<>2200 AND  tabArtigos.grp0<>3400 AND  tabArtigos.grp0<>8900 AND  tabArtigos.grp0<>8800 AND  tabArtigos.grp0<>3300 AND  tabArtigos.grp0<>109 AND  tabArtigos.grp0<>107 AND  tabArtigos.grp0<>800 AND  tabArtigos.grp0<>2600 AND  tabArtigos.grp0<>3800 AND  tabArtigos.grp0<>9100 AND  tabArtigos.grp0<>108 AND  tabArtigos.grp0<>2700 AND  tabArtigos.grp0<>1700 AND  tabArtigos.grp0<>8500 AND  tabArtigos.grp0<>4500 AND  tabArtigos.grp0<>9600 AND  tabArtigos.grp0<>8300 AND  tabArtigos.grp0<>125 AND  tabArtigos.grp0<>3700 AND  tabArtigos.grp0<>1400 AND  tabArtigos.grp0<>2800 AND  tabArtigos.grp0<>2900 AND  tabArtigos.grp0<>2500) AND ( tabArtigos.grp1=14000208 OR  tabArtigos.grp1=80000225 OR  tabArtigos.grp1=17000225 OR  tabArtigos.grp1=34000017) AND ( t
abArtigos.grp1<>24000165 AND  tabArtigos.grp1<>91000165 AND  tabArtigos.grp1<>92000165 AND  tabArtigos.grp1<>12000052 AND  tabArtigos.grp1<>23000052 AND  tabArtigos.grp1<>15000105 AND  tabArtigos.grp1<>17000010 AND  tabArtigos.grp1<>36000017 AND  tabArtigos.grp1<>28000017 AND  tabArtigos.grp1<>38000017 AND  tabArtigos.grp1<>99990000 AND  tabArtigos.grp1<>49000242 AND  tabArtigos.grp1<>17000065 AND  tabArtigos.grp1<>13000094 AND  tabArtigos.grp1<>33000094 AND  tabArtigos.grp1<>24000094 AND  tabArtigos.grp1<>91000094 AND  tabArtigos.grp1<>34000094 AND  tabArtigos.grp1<>27000094 AND  tabArtigos.grp1<>16000094 AND  tabArtigos.grp1<>19000245 AND  tabArtigos.grp1<>22000235 AND  tabArtigos.grp1<>29000214 AND  tabArtigos.grp1<>87000246 AND  tabArtigos.grp1<>2000001 AND  tabArtigos.grp1<>2000002 AND  tabArtigos.grp1<>34000092 AND  tabArtigos.grp1<>29000149 AND  tabArtigos.grp1<>30000149 AND  tabArtigos.grp1<>28000189 AND  tabArtigos.grp1<>17000058 AND  tabArtigos.grp1<>15000067 AND  tabArtigos.grp1<>28000067 AND  tab
Artigos.grp1<>30000067 AND  tabArtigos.grp1<>34000067 AND  tabArtigos.grp1<>35000067 AND  tabArtigos.grp1<>36000067 AND  tabArtigos.grp1<>16000067 AND  tabArtigos.grp1<>40000067 AND  tabArtigos.grp1<>84000002 AND  tabArtigos.grp1<>33000224 AND  tabArtigos.grp1<>19000236 AND  tabArtigos.grp1<>16000224 AND  tabArtigos.grp1<>89000201 AND  tabArtigos.grp1<>92000201 AND  tabArtigos.grp1<>30000070 AND  tabArtigos.grp1<>11000230 AND  tabArtigos.grp1<>1200000 AND  tabArtigos.grp1<>1200001 AND  tabArtigos.grp1<>81000186 AND  tabArtigos.grp1<>24000205 AND  tabArtigos.grp1<>23000205 AND  tabArtigos.grp1<>80000233 AND  tabArtigos.grp1<>35000107 AND  tabArtigos.grp1<>28000107 AND  tabArtigos.grp1<>38000107 AND  tabArtigos.grp1<>13000064 AND  tabArtigos.grp1<>30001494 AND  tabArtigos.grp1<>34000199 AND  tabArtigos.grp1<>22000086 AND  tabArtigos.grp1<>29000057 AND  tabArtigos.grp1<>24000030 AND  tabArtigos.grp1<>32000030 AND  tabArtigos.grp1<>28000122 AND  tabArtigos.grp1<>37000122 AND  tabArtigos.grp1<>3000001 AND  tabArt
igos.grp1<>34000202 AND  tabArtigos.grp1<>35000202 AND  tabArtigos.grp1<>36000202 AND  tabArtigos.grp1<>15000143 AND  tabArtigos.grp1<>28000143 AND  tabArtigos.grp1<>1100000 AND  tabArtigos.grp1<>36000142 AND  tabArtigos.grp1<>34000142 AND  tabArtigos.grp1<>34000152 AND  tabArtigos.grp1<>36000048 AND  tabArtigos.grp1<>87000065 AND  tabArtigos.grp1<>49000241 AND  tabArtigos.grp1<>35000079 AND  tabArtigos.grp1<>24000031 AND  tabArtigos.grp1<>28000031 AND  tabArtigos.grp1<>30000212 AND  tabArtigos.grp1<>1000106 AND  tabArtigos.grp1<>29000153 AND  tabArtigos.grp1<>25000153 AND  tabArtigos.grp1<>28000188 AND  tabArtigos.grp1<>13000162 AND  tabArtigos.grp1<>33000150 AND  tabArtigos.grp1<>1150000 AND  tabArtigos.grp1<>15000217 AND  tabArtigos.grp1<>46000217 AND  tabArtigos.grp1<>49000244 AND  tabArtigos.grp1<>32000050 AND  tabArtigos.grp1<>16000117 AND  tabArtigos.grp1<>15000136 AND  tabArtigos.grp1<>32000136 AND  tabArtigos.grp1<>28000136 AND  tabArtigos.grp1<>93000012 AND  tabArtigos.grp1<>1000105 AND  tabArtigos
.grp1<>1000101 AND  tabArtigos.grp1<>1000103 AND  tabArtigos.grp1<>1000104 AND  tabArtigos.grp1<>1000102 AND  tabArtigos.grp1<>1020000 AND  tabArtigos.grp1<>1040000 AND  tabArtigos.grp1<>1110000 AND  tabArtigos.grp1<>1120000 AND  tabArtigos.grp1<>1060000 AND  tabArtigos.grp1<>1060001 AND  tabArtigos.grp1<>1030000 AND  tabArtigos.grp1<>1130000 AND  tabArtigos.grp1<>82000010 AND  tabArtigos.grp1<>11000135 AND  tabArtigos.grp1<>30000135 AND  tabArtigos.grp1<>13000116 AND  tabArtigos.grp1<>24000116 AND  tabArtigos.grp1<>40000116 AND  tabArtigos.grp1<>28000030 AND  tabArtigos.grp1<>12000030 AND  tabArtigos.grp1<>15000030 AND  tabArtigos.grp1<>21000030 AND  tabArtigos.grp1<>16000044 AND  tabArtigos.grp1<>28000204 AND  tabArtigos.grp1<>46000204 AND  tabArtigos.grp1<>30000213 AND  tabArtigos.grp1<>33000213 AND  tabArtigos.grp1<>1300000 AND  tabArtigos.grp1<>29000203 AND  tabArtigos.grp1<>30000203 AND  tabArtigos.grp1<>28000210 AND  tabArtigos.grp1<>13000198 AND  tabArtigos.grp1<>17000237 AND  tabArtigos.grp1<>300001
53 AND  tabArtigos.grp1<>32000049 AND  tabArtigos.grp1<>46000049 AND  tabArtigos.grp1<>11000056 AND  tabArtigos.grp1<>91000056 AND  tabArtigos.grp1<>27000056 AND  tabArtigos.grp1<>28000056 AND  tabArtigos.grp1<>32000056 AND  tabArtigos.grp1<>16000056 AND  tabArtigos.grp1<>13000228 AND  tabArtigos.grp1<>42000228 AND  tabArtigos.grp1<>15000209 AND  tabArtigos.grp1<>28000209 AND  tabArtigos.grp1<>13000130 AND  tabArtigos.grp1<>24000130 AND  tabArtigos.grp1<>1200009 AND  tabArtigos.grp1<>35000195 AND  tabArtigos.grp1<>11000137 AND  tabArtigos.grp1<>26000087 AND  tabArtigos.grp1<>15000111 AND  tabArtigos.grp1<>49000243 AND  tabArtigos.grp1<>12000174 AND  tabArtigos.grp1<>15000174 AND  tabArtigos.grp1<>28000174 AND  tabArtigos.grp1<>23000174 AND  tabArtigos.grp1<>46000174 AND  tabArtigos.grp1<>46000159 AND  tabArtigos.grp1<>11000014 AND  tabArtigos.grp1<>11000180 AND  tabArtigos.grp1<>26000190 AND  tabArtigos.grp1<>49000239 AND  tabArtigos.grp1<>81000076 AND  tabArtigos.grp1<>89000076 AND  tabArtigos.grp1<>8800007
6 AND  tabArtigos.grp1<>6000001 AND  tabArtigos.grp1<>1090000 AND  tabArtigos.grp1<>16000035 AND  tabArtigos.grp1<>1070000 AND  tabArtigos.grp1<>27000025 AND  tabArtigos.grp1<>34000195 AND  tabArtigos.grp1<>15000021 AND  tabArtigos.grp1<>11000021 AND  tabArtigos.grp1<>24000021 AND  tabArtigos.grp1<>28000021 AND  tabArtigos.grp1<>26000194 AND  tabArtigos.grp1<>28000194 AND  tabArtigos.grp1<>19000226 AND  tabArtigos.grp1<>8000001 AND  tabArtigos.grp1<>30000196 AND  tabArtigos.grp1<>96000003 AND  tabArtigos.grp1<>93000003 AND  tabArtigos.grp1<>95000004 AND  tabArtigos.grp1<>5000001 AND  tabArtigos.grp1<>14000219 AND  tabArtigos.grp1<>16000219 AND  tabArtigos.grp1<>23000119 AND  tabArtigos.grp1<>92000119 AND  tabArtigos.grp1<>33000119 AND  tabArtigos.grp1<>24000119 AND  tabArtigos.grp1<>25000119 AND  tabArtigos.grp1<>40000119 AND  tabArtigos.grp1<>47000159 AND  tabArtigos.grp1<>1080000 AND  tabArtigos.grp1<>13000036 AND  tabArtigos.grp1<>16000036 AND  tabArtigos.grp1<>33000054 AND  tabArtigos.grp1<>49000240 AND
 tabArtigos.grp1<>28000085 AND  tabArtigos.grp1<>17000000 AND  tabArtigos.grp1<>5000003 AND  tabArtigos.grp1<>11000166 AND  tabArtigos.grp1<>25000078 AND  tabArtigos.grp1<>35000078 AND  tabArtigos.grp1<>34000078 AND  tabArtigos.grp1<>48000151 AND  tabArtigos.grp1<>24000216 AND  tabArtigos.grp1<>34000216 AND  tabArtigos.grp1<>45000214 AND  tabArtigos.grp1<>36000172 AND  tabArtigos.grp1<>27000172 AND  tabArtigos.grp1<>37000172 AND  tabArtigos.grp1<>28000172 AND  tabArtigos.grp1<>40000207 AND  tabArtigos.grp1<>1250000 AND  tabArtigos.grp1<>28000113 AND  tabArtigos.grp1<>37000113 AND  tabArtigos.grp1<>11000103 AND  tabArtigos.grp1<>34000033 AND  tabArtigos.grp1<>26000032 AND  tabArtigos.grp1<>11000171 AND  tabArtigos.grp1<>83000009 AND  tabArtigos.grp1<>85000154 AND  tabArtigos.grp1<>89000154 AND  tabArtigos.grp1<>95000154 AND  tabArtigos.grp1<>49000232 AND  tabArtigos.grp1<>34000077 AND  tabArtigos.grp1<>28000077 AND  tabArtigos.grp1<>24000077 AND  tabArtigos.grp1<>36000077 AND  tabArtigos.grp1<>37000077 AND  t
abArtigos.grp1<>35000077 AND  tabArtigos.grp1<>38000077 AND  tabArtigos.grp1<>86000163 AND  tabArtigos.grp1<>84000218 AND  tabArtigos.grp1<>89000218 AND  tabArtigos.grp1<>83000007 AND  tabArtigos.grp1<>89000007 AND  tabArtigos.grp1<>92000007)
0
 
LVL 4

Expert Comment

by:vindevogel
Comment Utility
right yeah ;-)
lol
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
Comment Utility
If you check for equality, you don't need to check for the opposite!

Example:
AND ( tabArtigos.grp0=4200 OR  tabArtigos.grp0=9999
OR  tabArtigos.grp0=9500 OR  tabArtigos.grp0=1600 OR  tabArtigos.grp0=1200) AND ( tabArtigos.grp0<>3000
AND  tabArtigos.grp0<>2400 AND  tabArtigos.grp0<>1100 AND  tabArtigos.grp0<>4600 AND  tabArtigos.grp0<>3200
AND  tabArtigos.grp0<>1300 AND  tabArtigos.grp0<>1500 AND  tabArtigos.grp0<>4700 AND  tabArtigos.grp0<>120

Can be simplified to :
AND ( tabArtigos.grp0=4200 OR  tabArtigos.grp0=9999
OR  tabArtigos.grp0=9500 OR  tabArtigos.grp0=1600 OR  tabArtigos.grp0=1200)

Simplify your query using the IN operator:

SELECT PKID, Name
FROM tabArtigos
WHERE tabArtigos.Pkid>0  
AND tabArtigos.grp0 IN (4200,9999, 9500,1600, ...)
AND tabArtigos.grp1 NOT IN (24000165, 91000165, 92000165, 12000052, ...)
0
 

Author Comment

by:nvivas
Comment Utility
thank u
(by the way i solved the problem with temp tables)
i think i need a vacation....
thanks once again
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now