Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain SQL Login information for Microsoft Query using Excel VBA
Surely it's in the first line? ... PWD=itg
-- Regards Andy Wiggins www.BygSoftware.com Home of "Save and BackUp", "The Excel Auditor" and "Byg Tools for VBA" "Ryan" wrote in message ... I trying to open a Microsoft Query using VBA, but I cannot seem to figure out how to store the SQL Database password when running the Query. Listed below is the current code that I'm using DSN = "DSN=e-work;UID=e-work;PWD=itg" SelServer = "e-work" SelPath = "uscles405\inst1\" SqlId = SqlOpen(DSN) With ActiveSheet.QueryTables.Add(Connection:= _ "FINDER;\\USCLES611\PURCHDATA\DATABASE\HK global po FINAL.dqy", Destination:=Range("A1")) .Name = "HK global po FINAL" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True DSN = "DSN=e-work;UID=e-work;PWD=itg" SelServer = "e-work" SelPath = "uscles405\inst1\" SqlId = SqlOpen(DSN) .Refresh BackgroundQuery:=False End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ODBC Microsoft Access Driver Login Failed | Excel Discussion (Misc queries) | |||
ODBC Microsoft Access Driver Login Failed - Excel 2003 | Excel Discussion (Misc queries) | |||
ODBC Microsoft Access Driver Login Failed | Excel Worksheet Functions | |||
Excel 2000 required username and password login for database query | Setting up and Configuration of Excel | |||
Login Information | Excel Programming |