Thread: OpenRecordset
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
fred fred is offline
external usenet poster
 
Posts: 73
Default OpenRecordset

Thanks for help TK but it doesn't work.
I'm not connecting to a MS Access database.
When using the Data:Get External Data:Create New Query options from the
Excel menu it connects and retreives data fine.
I have recorded a macro when I do this and it is listed below and when I run
it, it works fine.
How can I now get that data into a recordset instead of returning it to the
worksheet?
I tried your routine by setting the DB_CONNECT_STRING to "ODBC;DSN=TIMS.udd"
but it doesn't connect.

Thanks Fred

Sub Macro2()
With ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN= TIMS.udd;", _
Destination:=Range("A1"))
.Sql = Array("SELECT CLNDR.DATE_, CLNDR.FILLER1 FROM root.CLNDR
CLNDR")
.FieldNames = True
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = True
.SaveData = True
End With
End Sub

"TK" wrote in message
...
Hi Fred: