Hi All,
I have Access in my corpo and so I have made in Excel query in workboock with ODBC;DSN=MS Access Database;DBQ=C:\TL\OBLICZENIA.accdb;DefaultDir=C:\ TL;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5; and when i try to refresh it at home I have an error that database engine can not find destination query (sorry if I translate it wronge, I get this in PL language). What can be the reason of it? I tried also vba method but then i have info Run-time error '1004'. Below vba code I use :
I did this several years ago with access 2003, ofcourse with different driver, and it worked.Code:Sub dwa() sqlstring = "select * from ZALEGACZE" connstring = "ODBC;DSN=MS Access Database;DBQ=C:\TL\OBLICZENIA.accdb;Driver={Microsoft Access Driver (*.mdb, *.accdb)}" 'MsgBox (connstring) With ActiveSheet.QueryTables.Add(Connection:=connstring, _ Destination:=ActiveSheet.Range("A3"), Sql:=sqlstring) .SaveData = False .FieldNames = True .Name = "Contact List" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = False .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With End Sub
Please help.
TomL


Reply With Quote

