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!!
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Watch MrExcel Video

Forum statistics

Threads
1,122,421
Messages
5,596,033
Members
414,039
Latest member
southike

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
Top