View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] gimme_this_gimme_that@yahoo.com is offline
external usenet poster
 
Posts: 129
Default Query text too long

I fathom that the 255 limit depends on your database and your database
driver.

I use ODBC with DB2 and execute queries having over 3,000 characters.
All the time. No problems.

As to getting field names:

Dim rs As ADODB.Recordset
Set rs = command.Execute
Dim field As ADODB.field
Dim fieldIndex As Integer
fieldIndex = 1
For Each field In rs.Fields
sheet.Cells(1, fieldIndex).Value = field.Name
fieldIndex = fieldIndex + 1
Next field