...
gs_Conn = "Provider=SQLOLEDB;Persist Security Info=False;Initial Catalog=DBNamex;User ID=Userx;Pwd=passwordx;Data Source=Serverx"
'This works
Set conn = New ADODB.Connection
conn.Open gs_Conn
...
'This returns a Error 1004 Application-defined or object-defined error
...
Set qryTable = wksQuery.QueryTables.Add( _
Connection:=gs_Conn, _
Destination:=wksQuery.Cells(1, 1), _
Sql:=strSQL)
|