ACC: Limit on ANDs in SQL Select Statement (92690)



The information in this article applies to:

  • Microsoft Access 1.0
  • Microsoft Access 1.1
  • Microsoft Access 2.0
  • Microsoft Access for Windows 95 7.0
  • Microsoft Access 97

This article was previously published under Q92690
Moderate: Requires basic macro, coding, and interoperability skills.

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

Microsoft Access 1.x returns the following error message when you exceed this limit:
Out of Memory

Microsoft Access 2.0, 7.0 and 97 return the following error message when you exceed this limit:
Query is too complex

Modification Type:MajorLast Reviewed:5/28/2003
Keywords:kberrmsg kbinfo kbusage KB92690