Character limit to SQL select string

  • Thread starter Thread starter JimP
  • Start date Start date
J

JimP

Is there a 255 character limit to the length of a SQL SELECT statement in
VBA, e.g.

strSQL="SELECT... (max 255 chars yes or no)"?
 
JimP said:
Is there a 255 character limit to the length of a SQL SELECT statement in
VBA, e.g.

strSQL="SELECT... (max 255 chars yes or no)"?


No, 64,000+ is the limit.

If you are stuffing an SQL string into a Row or Record
Source property, then the limit is 32,000+

(See Specifications in VBA Help)
 
Is there a "standardized" way to break up a long SQL select statement, given
that " _" does not function as a line continuation for a string. e.g.

strSQL1 = "SELECT....."
strSQL2 = "FROM........"
strSQL =strSQL1 & strSQL2
 
StrSQL = "SELECT Field1, Field2, Field3 " & _
"Field4, Field5" & _
" FROM NameYourPoison Inner Join" & _
" OtherTable On NameYourPoison.ID = OtherTable.FID" & _
" WHERE x = y"

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JimP said:
Is there a "standardized" way to break up a long SQL select statement,
given that " _" does not function as a line continuation for a string.
e.g.

strSQL1 = "SELECT....."
strSQL2 = "FROM........"
strSQL =strSQL1 & strSQL2
 
Two common styles:

strSQL = "SELECT..... " _
& "FROM........"
or

strSQL = "SELECT..... "
strSQL = strSQL & "FROM........"
 
Back
Top