Every time i want to refresh data from accounting database, DB login window pops up. Is it possible to add the login and password into the connection string below to bypass the login window?? Thanks
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=SOTAMAS90;Description=MAS 90 4.0 ODBC Driver;Directory=M:\mas4\MAS90;Prefix=M:\mas4\MAS90\SY\, M:\mas4\MAS90\==\;ViewDLL=M:" _
), Array( _
"\mas4\MAS90\HOME;CacheSize=4;DirtyReads=1;BurstMode=1;StripTrailingSpaces=1;SERVER=NotTheServer" _
)), Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT AP_InvoiceDetail.VendorNo" & Chr(13) & "" & Chr(10) & "FROM AP_InvoiceDetail AP_InvoiceDetail")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table_Query_from_SOTAMAS903"
.Refresh BackgroundQuery:=False
End With
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=SOTAMAS90;Description=MAS 90 4.0 ODBC Driver;Directory=M:\mas4\MAS90;Prefix=M:\mas4\MAS90\SY\, M:\mas4\MAS90\==\;ViewDLL=M:" _
), Array( _
"\mas4\MAS90\HOME;CacheSize=4;DirtyReads=1;BurstMode=1;StripTrailingSpaces=1;SERVER=NotTheServer" _
)), Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT AP_InvoiceDetail.VendorNo" & Chr(13) & "" & Chr(10) & "FROM AP_InvoiceDetail AP_InvoiceDetail")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table_Query_from_SOTAMAS903"
.Refresh BackgroundQuery:=False
End With