Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ODBC Microsoft Access Driver Login Failed Sue[_2_] Excel Discussion (Misc queries) 1 October 10th 08 08:09 AM
ODBC Microsoft Access Driver Login Failed - Excel 2003 Neil Holden Excel Discussion (Misc queries) 0 October 6th 08 08:54 AM
ODBC Microsoft Access Driver Login Failed BARRIOSWJ Excel Worksheet Functions 0 March 6th 07 10:20 PM
Excel 2000 required username and password login for database query ISTech Setting up and Configuration of Excel 0 September 7th 05 01:11 AM
Login Information Arvind P Rangan Excel Programming 3 February 9th 04 03:18 PM


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"