Question : VBA: Automatically ByPass the Username/Password "ODBC for Oracle Connect" dialog box - not manually

So here is preliminary information before I ask the question:

Currently, I have approximately 13 different "Microsoft Query" .dqy file extensions currently in my C:\ by which I am accessing via Excel's "Import database query" section. I have written a macro using the opendatabase method by which I am able to successfully load the .dqy file and import the results of the .dqy file back into my worksheet iwth a username/password

The code for this is as shown below:

Public Sub Students_Compliant_Quality_Docs()
.......................
numstuds_compliant = "SQL Queries for Compliance Report\% of Students Compliant on Quality Docs.dqy"

'Opens the database to determine the number of students
Set Open_DB1 = Workbooks.OpenDatabase(filename:="C:\" & numstuds_compliant)
.......................
End Sub

When the Username/Password dialog box with title "Microsoft ODBC for Oracle Connect" loads, I type in my username/password and my results are displayed.

Now, What I trying to do is BYPASS the the username/password box by typing in the username/password directly into my vba code. What changes do I need to make to this code to get this to work? Since this is a .dqy (Microsoft Query) file with over 100 lines of SQL code (please don't ask why...I know you must be thinking this is a mess =)... for a good reason), how can I make this work? I am sure there has to be a way because when I go to Microsoft Query, initially I have noticed that I will need to type in my password, but from then on, I don't if I need to open another .dqy file.

Any help is highly appreciate and I look forward to hearing from you shortly.

Sincerely,

Piyush A.

Answer : VBA: Automatically ByPass the Username/Password "ODBC for Oracle Connect" dialog box - not manually

PAQed with points refunded (500)

Computer101
EE Admin
Random Solutions  
 
programming4us programming4us