Major Issues connecting to a database with auto password

piyushdabomb

New Member
Joined
Aug 15, 2007
Messages
3
I have a macro which uses the opendatabase method to run a "Microsoft Query" .dqy file. Whenever I run the macro, I am prompted for a Username and password in the "Microsoft ODBC for Connect" window where I can then successfully use the SQL information the .dqy file to run my query and return it back to excel.

The issue I am currently have is to bypass the password connection for this .dqy file. What I am trying to do is run this statement:

Code:
numstuds_total = "SQL Queries for Compliance Report\# of students past due-MDR-PEH-CAPA.dqy"

Set Open_DB2 = Workbooks.OpenDatabase(Filename:="C:\" & numstuds_total)

without having to keep placing in the password. The alternative I tried was to open the connection to the database and then try to open the dqy file, but I am still prompted for a password.

Code:
Dim objConn As ADODB.Connection
Set objConn = New ADODB.Connection

With objConn
    .Provider = "msdaora"
    .ConnectionString = "DSN=GTMSP;"
    .Open "Provider = msdaora; Data Source = GTMSP; User Id = PLATEAU; Password = plateau"
    
End With

Any thoughts, comments..please let me know. I am looking forward to hearing from you soon!!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,415
Messages
6,119,375
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top