View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dan[_3_] Dan[_3_] is offline
external usenet poster
 
Posts: 8
Default ODBC excel Macro help needed

Can someone tell me what is wrong with this?

With Selection.QueryTable
.Connection = Array(Array( _
"ODBC;DSN=Commerce
Center;DATABASE=CommerceCenter;Trusted_Connection= Yes"))
.CommandText = Array( _
"SELECT *" _
, _
"" & Chr(13) & "" & Chr(10) & "" _
, _
"FROM CommerceCenter.dbo.p21_view_inv_mast p21_view_inv_mast" _
)
.Refresh BackgroundQuery:=False
End With


I'm in an excel spreadsheet. I can edit the query and that works fine but
from within the macro I keep getting a "Run-time error '1004' -
Application-defined or object-defined error". I have shortened this query
down as much a possible but still get the error.

Dan