Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Limit on ANDs in SQL Select Statement


View products that this article applies to.

Summary

There is an undocumented limit on the number of ANDs that you can use in an SQL Select statement. The limit is 99 ANDs in a WHERE clause and 99 ANDs in a HAVING clause.

Microsoft Access 2000 returns the following error messages when you exceed this limit:

Expression too complex
-or-
Query is too complex.

The error can also occur if the query includes a Switch() function expression that contains more than 13 argument sets. The workaround is to create a user-defined function (UDF) incorporating a Select Case statement, and calling the UDF from the query.

↑ Back to the top


References

For more information about SQL statements and clauses, click Microsoft Access Help on the Help menu, type work with sql in queries, forms, reports, macros, and modules in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB209761, kbusage, kbinfo, kbhowto, kberrmsg

↑ Back to the top

Article Info
Article ID : 209761
Revision : 3
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 336