Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

ADO Connection With A Password

Ever since I set a password on my Access Database my appllication doesn't open it.
I tried changing somethings on my ado connection with no success.

I get this error:
Test connection failed because of an error in initializingh provider..
The workgroup information file is missing or opened exclusively by another user.

Is there something else I should try? Changing connection type?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Put Password In Access For Connection String Password?
I want that no one can open Access database that is shipped with My App.
I use following connection String.
cnnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "" & DBName & ";User Id=Admin;Password=MyPw"

Without using password and configuring any thing in Access, it works fine. But using Password, I can't Open DB.
TO use Password in connection string, what should I set in Access?

I tried :
1. Open exclusive, Tools --> Security --> Set Database Password ==> didn't work
2. User and Group Accounts --> Change Logon Pass for Admin.. ==> didn't work..

Does any one know how to do this?

Thank you..

Password Connection
Hello i've made some sort of ftp manager with my own likings offcourse. But now i want to add a password protection in it, so when i try to connect to the server it compares the pass i filled in the client. The person with the server is able to set his own pass, inorder to connect to the server the client has to fill in the pass the server is using, if the client filled this is correctly he can connect to the server if he didnt then the connection is refused. Now my question is how can i make this password protection.

DAO Connection With Password
anybody would help out this

i am using in the module


public sub main()
set db=opendatabase(APP.Path & "something.mdb")
end sub

backend is access database, i want to secure the DB with the password

any solutions

thanks for your reply

Connection Password

I have a database password set for a MSAcess database and can't connect using the connection1(Data Environment1)object. The connection source opens the data link property dialog box (provider = microsoft jet 3.51 OLE DB provider) and when I type the password, the test connection fails with the error---The workgroup information file is missing or opened exclusively by another user. Any advice would be helpful.


Password Using Data Connection
hi i would like to ask how to connect a password using data base

pls help me

Connection String Vs Password
Hi guys

Below is my current connection string code

VB Code:
Set db = New ADODB.Connection    db.CursorLocation = adUseClient    db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:SPCPD_DATASPCPD.mdb;Persist Security Info=False"

I cannot access into database (MS-Acces) after I set password. The error msg are "Run-time error '2147217843 (80040ed)': Not a valid password."

What should I do? Need your advice guys.


Password For ODBC Connection
I've got an ActiveX coponent which connects to an Access database.

That database contains some tables which are actually in the database,and some are links to an Oracle database using ODBC

I have a query which looks up data on the Oracle DB.

The Access database doesn't require a password to open but when I run a query on the oracle tables it wants a password.

How can pass a password in the query?

DAO JET Connection Access Password
Hi everybody, please someone help me with this.
Why this code are given error ?

'DAO example with JET connection
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "dbFile.mdb", "; pwd = pass ")


ODBC Connection Password
 I have problem connecting a secured SQL server with an ODBC through VB.  I setup the ODBC, I can connect through the ODBC Manager. Here is the connection string:

Provider=MSDASQL.1;Persist Security Info=TRUE;PASSWORD= 1234;User ID=ABCD;Data Source=DataWeb

Here is the error message:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

I know I have access. I can use the SQL manager with the same username and password

So I guess my Username and Password are not pass the right

Can somebody help me please.


Connection To Access + Password
How can I create a password to an Access database so a user can't open the database from the explorer but I could open it through vb code?
please note how do I create the password in access and what code do I have to write in vb in order to connect to the database.

thanks in advance,


Connection String For Access W/password
I'm trying to figure out how to connect to a pword protected access database thru vb6 using ado.
I did some searching and tried some of the examples in, but I'm still having problems.

The example from that page that applies is: oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:somepathmydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"

But my db doesn't have a username.
I've only given it a password to keep prying eyes from opening it directly.

The connectionstring I use to open it without a password is:AdoSettings.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Eva.mdb;Persist Security Info=False"

Can someone tell me how to modify the above connection string to include a password?

Specifying Username And Password In Connection String

I'm using VB6.0 and ADO2.8 to access an MS AccessXP database file. I want to specify username and password in the connection string. The problem is that it seems I also need to specify the path to .mdw Access workgroup definition file somehow. Does anybody know how to do it?


ADO Connection String For Access W Password

anybody know how to open passworded access db with ADO .... ?

I use this one and not workout :

with connobj
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Password=aaa;Data Source=" & strDataPath & ";Persist Security Info=False"
end with

the error msg sound like this
'The workgroup information file is missing or opened exclusively by another user'

thank you..

Passing Database Password Through UDL Connection?
I want to use a UDL file to set up an ADO connection to a password-protected Access database.  I'm using this line to open my connection to the database db1.mdb:

cn.Open "FILE Name=" & App.Path & "db1.udl"

Unless I save the database password in the UDL I get an error when I try to open the connection.  Saving the password in the UDL kind of defeats the purpose of using a password.  How can I pass the password to the database from within my program?

How Do I Use USername And PAssword When Making Connection
I have a quick question regarding using usernames and passwords to Access the Back end DB.
The code I use to access my DB is

conn1.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
           "Dbq=\ServerMy DocumentsAssetDB.mdb;" & _
           "Uid=admin;" & _

How do I make use of the Uid and Pwd features. WIll I need to code a form for this???

Thanks for any and all help

Oracle Connection && Password Prompt
Hi Guys,

Need a little help bypassing the User ID / Password dialog box. I have established the DSN and all othe ODBC settings when I created the link to an Oracle table from Access. I need to programatically bypass being prompted for password when I run a query I have designed. Help!


How To Store Password In Oledb Connection
       I am making crystal report and saving it on the server. I am using OLEDB connection to connect it with SQL database. MY problem is that connection doesn't store password although I am checking the save password check box on the data link control....whenever I open the report it shows me error unable to connect with database. Can anybody help me out in this regard.

Database Connection Using Windows Id And Password
Hi all,
I am using the following to connect to oracle database through VB. Here I am explicitly specifying userid and password in the code.
Is there a way to grab the windows login id and password and use it as user id and password in here?


Dim conn As New ADODB.Connection
conn.ConnectionString = "provider=msdaora.1;user id=XYZ;password=ABCD;data source = DSource;option=1+2+8+32+2048+16384"



Send Password In The Connection String
how to send password in the connection string, to open an access database in VB program, so as to open a secured database in a VB program.

Access Report Password Protected From VB5 DAO Connection
Can anybody help me out with this one: I have an Access Report that I would like to call from my Visual Basic Application, the Access Database is password protected.

here is the code I've been trying:

dim objAccess as Object

Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase AppPath & "DBName.mdb"
objAccess.Visible = False
objAccess.DoCmd.OpenReport "ReportName", acViewPreview
Set objAccess = Nothing

' This other one didn't work either
' CrystalReport1.ReportFileName = AppPath & "ReportName.rpt"
' CrystalReport1.Password = "Password1"
' CrystalReport1.Destination = crptToPrinter
' CrystalReport1.Action = 1
If there is a way that I could get rid of those and call the Access Report from Visual Basic instead you know, without using Access library OR if there is an easier way to include the password on the connection, It will be helpfull a lot.

tks. in advance.

Edit by Moderator: Please use the [vb][/vb] tags when you post your code. Reply to, or edit this post to see how.

DAO Data Control Connection With Password In Database
Hi Guys,
This has been sticking me for ages,

I have a password protected database, the password is "test"

I use a Data control on my form and cannot get the connection with password to be accepted.
what ive been trying is

Data2.DatabaseName = App.Path & "my.mdb;PWD=Test"

This just wont work, Ive been through my books and cant find anything.

any thoughts welcome.

Regards as ever

RESOLVED - Setting DB Password In Connection String

Can someone tell me where I may be going wrong? I have developed an app with an open Access DB. Now that it's fully tested and ready to install, I set the db password in Access and modified the Connection String in my code tp include the password, as follows: "Provider = ...; DataSource = ....; ; password"

from the previous "Provider = ...; DataSource = ...."

I also tried "Provider = ...; DataSource = ....; userid ; password" "Provider = ...; DataSource = ....; userid = admin; pwd = password"

but I keep getting the following error messages:

"ISAM not found"


"Password Not Valid"

What am I doing wrong?



Edited by - GoodGuy on 8/6/2005 5:34:22 AM

Opening MDB Access File Connection With Password

I'm opening an MDB database file and need to provide a password. How do I add password to this line:

activeDatabase = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & myDatabase
dbDatabase.Open activeDatabase

Connection Strings + Password Protected Excel
Hi Pals.
Do everyone know how to access excel connection strings with password protected?
let said x.xls protected with password 123

connection strings:
connX = "Driver={Microsoft Excel Driver .xls)};DriverId=790;Dbq=c:DemoImportx.xls;DefaultDir=c:DemoImport;"

where to add password from the above line?


Sorted - Thanks Fran C --> Opening A Connection To Database With Password
Can I use the Microsoft.Jet.OLEDB.3.51 provider when opening a Connection to a database with a password?

At the moment I am opening my connection as follows:
Set Conn = New ADODB.Connection
Conn.CursorLocation = adUseServer
Conn.Open "Provider = Microsoft.Jet.OLEDB.3.51; Persist Security Info = FALSE;Data Source = " & app.Path & "Data.mdb"
But I need to password protect my database. I don't want to have to connect via ODBC.

:Connection String Of Password Protected Access Database
Hi what will be the connection string if i put a password to my access database?

I used this connection string:

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "payroll.mdb;
                                     Persist Security Info=False;"

But after i put a security in my access database, i got an error whenever i login.

Run-time error '-2147217843 (80040e-4d)':
Not a valid password.

How do i fix this, please help..

Edited by - milenyume on 1/24/2006 6:21:46 PM

Data Environment Connection Problem Using MSAccess97 Database With Password
Hello Everyone,

How should be my connection if the database in MSAccess have a password?

In the Data Environment Properties it ask for the Provider which i just select from the list Microsoft.Jet.OLEDB.4.0 and in the connection tab it ask for the database name which i supplied where the database located and also ask for the username and password which i did enter the desired username and password but when i test the connection it fails.

Please Help.


Password Protected Program And Changing User Name And Password At Run Time??
i have a project i want to make it password protected and also want to change username and password at run time

How To Store Username And Password Using Windows Password Management(not In A File)
Dear All,

I have been trying to get an idea on how to use windows inbuild username password process to store VB application users username passwords & giving them proper privilages in VB modules


Pass A Password To A Password Protected Access Database Using OLE??
I need to pass a password to an access database that is password protected.

This database is going to be opened by a vb app, that uses the access application ref. 9.0 libary. What I need to do is open a report in preview mode. All that I have done previously.

This is the code...

Dim AccessApp As Access.Application
Set AccessApp = New Access.Application

AccessApp.OpenCurrentDatabase ReadFromINI("DATABASES", "ESITE", App.Path & "settings.ini")
AccessApp.DoCmd.OpenReport "rptAnvändarLösen", acViewNormal

Set AccessApp = Nothing

When I have done this before the OpenCurrentApplication had a seperate input for password, but not the 9.0 library...

How can I answer the password box that now appears on the screen..???


Supplying Password For Password Protected Access Database
for protection of access database suppose i set password for the database.

then i have given the connection string to connection object of ADO. now if i open this connection for database i get an error.
so any suggestions in this matter are welcome.

I Want The Computer To Prompt Only For Network Password Without Windows Password

I want the computer to prompt only for network password without windows password. thanks for your reply.

Password Program- Storing The Username And Password
I want to know how to store a username and password in my program somehow so that the program won't forget it when the user exits the program. I have no idea how you would do that, so please, even if you aren't sure you're right, just give me your ideas! They may help me to be able to know what question I need to ask exactly, or you might even be right I am using VB 6.0. Please help!

Now, don't get me wrong, 'cause baseball's a great sport.
It teaches little children simple eye-hand coordination with little effort or exhaustion.


Change Password, And Password Expires???
Hi I have created a vb system and the user must login, i have this done where the user enters a name and password and this checks the database and allows the user into the system if name and password correct and generates and error if incorrect.

I now have to make the system so that it allows the user to change its password(it must not be the same as the user's previous 8 passwords). also the password must expire after 30 days, and also the password must have at least 7 characters one of which is a digit!!!

i dont know hwere to start with this so please help me as i am hopeless at programming
please help me

Speed Up DBF Connection && Query (using Index Files (NDX) In Connection To DBF Database?)
My application works fine.
However, I am connecting to two DBF files and the queries are very slow.
[If I copy the DBF files to the local hard drive everything runs fast enough. 1-2 seconds vs. 6-8 minutes]
The DBF needs to stay on the network.

I am guessing that the data access model I am using is copying the entire DBF file across the network to memory and that it why it is slow. I am hoping that using the index will speed things up enough. So can anyone:

Can anyone tell me how or give me a code example on how to use index files?
Tell me more about using DBF files in a speedier manner?

Here connection string that I am currently using:
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=U:Data; ;Extended Properties=dBASE IV;"

Edited by - infinity on 11/1/2002 12:06:33 PM

I Want To Simulate The State Transfer Of TCP Protocol---the Connection Management(the Connection Pro
I want to simulate the state transfer of TCP protocol---the connection management(the connection process between serve and client).Who can help me?
i don't know how to start to write the program, and what should be the overall structure of the program.

anyone who has such experience or similar experience (as long as it is related to intranet application), can share with me?

VC experts.... can u give me some hints or ideas of help me find some souce code?

i welcome all response and give my thanks in advance!!!!!!!!

ADO Connection Problem When DialUp-Connection Has Been Closed And Reopened
Hello out there,

I got a big problem.

My app uses a SQL Server via DialUp-Connection. When the Connection may be closed by an user or another application the connection will be reopend automatically. But the ADO connection object still remains in open state [(adoConnection.State = adStateOpen) = True].

Who can help me to evaluate whether the connection is really open or not?

Thanks, X-Ray

How To Disable Connection Pooling From SQL SERVER, Not Thru Connection String
my friend has getting "SQL Server Does Not Exist or Access Denied" and it is related to TCP-IP , now i want to simulate that error on my m/c so i need to off the connection pooling.
Plz advise for disabling connection pooling (not thru connection string)

Having Trouble Programatically Setting Up The Connection String For OLE Connection
I am using VB to retrive a string I have in an access database. With the following code:

(myDB is declared publicly elsewhere... Public myDB As New ADODB.Connection)
Dim sPath As String
Dim myRS As New ADODB.Recordset
Dim sQuery as String

sPath = Environ("PeMMP_DB") & "ProvData"
myDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sPath & "PeMMP_DB.mdb;Password='pemmpadmin';Persist Security Info=False"
myRS.Open "SELECT Queries.Query_Text FROM [Queries] WHERE (((Queries.Query_Num)=" & sQNum & "));", myDB 'Model_Num value must be changed manually
sQuery = myRS.fields.Item(0).Value

I have it working when I take the variables out of the path, but I need to allow the program to pass variables in. Any help or suggestions are greatly app.

Also I am writing this in a VBA envronment but need to port it to VB6 when ready. Are there any issues with database connections and recordsets I need to be aware of?

Thanks very much.

Edited by - DaVBMan on 6/26/2006 12:42:30 PM

Connection String Not Accepting The UserId When Opening Connection With Sql.
I tried opening a database connection with sql
using the following code :

Dim lstrDbServer: lstrDbServer = "CD3CD3"
Dim lstrUserId: lstrUserId = "Administrator"
Dim lstrPassword: lstrPassword = "system"
Dim lstrDBName: lstrDBName = "Pubs"
Dim ConString
Dim connPubs

ConString = "Provider=MSDataShape;DATA PROVIDER=SQLOLEDB;Data Source=" & lstrDbServer & ";User Id=" & lstrUserId & ";Password=" & lstrPassword & ";Database=" & lstrDBName & ";Connect Timeout=10"

set connPubs = Server.CreateObject("ADODB.Connection")

connPubs.Open ConString

I got the following error :

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80004005)
Login failed for user 'Administrator'. Reason: Not associated with a trusted SQL Server connection.

Why am i getting this error.
When i installed sql Server 2000 i set the sql server username as Administrator & Password as system.
Is there some way i can find out the username & password that i had entered while installing, just to check the spelling.

Do get back to me.


Sending Login/password To Internet Browser Login/password Box
Once a browser has visited a URL that my program told it to visit how can i make my program enter in the login/password for that url if one comes up. How could it enter the login/pass for netscape and IE browsers.

Thanks in advance for your help.

How 2 Disconect Internet Connection Or Lan Connection Using Code
hello firiends

can any body have idea that i want disconnect the lan connection or internet connection after some perticular time assigned to perticular user.

i want todo it with vb code .

can any body guide me.

Thanks in advance for guidence


SELECTing A Recordset From Connection A And INSERTing Into Connection B
Using ADO 2.8 and VB6,

Can you take a recordset from one connection and maybe disconnect it, then re-connect it to a second database connection and insert the records?

Connection A is an Access database which varies in loctation.

Connection B is an MS SQL server database. The field name needed between the two operations are identical, I control the field name using alises in the original SELECT query on connection A.

Is this possible by some means? I can't use a linked-server on the MS SQL server database because this operation is performed by the end users of my program who do not have privledges to create and delete linked-servers as needed.

Make Connection Per ODBC (Connection + Command)
I try to connect my VB-programm by using an Environmentpage. I make (and test) a connection by ODBC. The connection is succesfull.
After that I make a connection to a table, by using a command.

From this command I put some fields on my Form.

When I start my programm, after putting the fields on my form, I get the following message;

'Unable to bind to field or datamember ; .....'

When I make the same connection in MS-Access, it succeed....

How can this happen and how can I solve my little problem????

ADODB.connection - How To Trace Which Connection Is Not Closing
I recently started working in a software company
they have a massive program with hundreds of thousands of code

I have done 2 days of tracing all cases where adodb connection was open and not closed properly

but there are still more places where adodb connection not closed..

in result we have and MDB files that are kept lock (ldb file exists)

is there an easy way to softly close this connection or I have no other way beside, stepping through each and every single procedure and make sure any open connection will be close when it finish??

Thank you

VB Code Code:
If Not rs Is Nothing Then
      If rs.State = adStateOpen Then rs.Close
      Set rs = Nothing
   End If
   If Not con Is Nothing Then
      If con.State = adStateOpen Then con.Close
      Set con = Nothing
   End If

Compare Password With Nt Password

Are there someone API that compare the password that the user type with your password (NT) ?

I have a form , where the user type login and password , and the analyt want that compare the password typed with password the user, agree login typed

I believe that do not work

thank you in advance

Unload Connection Usb, Reload Connection
I was wondering if I could write some code to unhook the usb connection of a hardware from my hardware devices manager, and then rehook it so the hardware loads up the device. This relates to the pole display I have from Ultimate Technology, PD1200, and what I need to do is just load the usb device into windows during startup. I would have to disconnect and reconnect manually, but I wanted to know if it is possible to code it instead, and if so could someone give me some background on it, or a link, to understand what I will have to do? I have been looking for a while, and I just want this thing to work. I went through all the customer, tech support I could, and they still can't help me. I just need to load the device during startup, and it will work.


DSN-less ADODB.Connection Connection String
I am trying to connect through ODBC to a sybase system 11 database without creating a DSN. Currently using:

Set m_Conn = New ADODB.Connection
Call m_Conn.Open("DRIVER={" & m_Driver & "};SERVER=" & m_Server & ";UID=" & m_Username & ";PWD=" & m_Password & ";DATABASE=" & m_Database, "", "")
But it is returning an error "Insufficient information to connect". Any ideas?

DAO Connection To SQL Database Using Trusted Connection??
I'm attempting to connect to a SQL database using DAO. The DSN was set up using a "trusted connection". In the past I've successfully used the below code to connect to Access databases - but it currently doesn't work for my SQL database (I've tried taking "UID=sa;PWD=;" out of the connect string and replacing it with variations of "Trusted Connection=Yes" but it doesn't work - syntax perhaps?). Will someone please enlighten me as to the problem? Many thanks...

Code Snippet:

Private m_sDsn As String 'Data Source
Private m_wWrkODBC As Workspace 'DAO workspace object
Private m_cConnectODBC As Connection 'DAO connection object

Set m_wWrkODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC)
Set m_cConnectODBC = m_wWrkODBC.OpenConnection("Connection1", , , _
"ODBC;DATABASE=;UID=id;PWD=pwd;DSN=" & m_sDsn)

Copyright © 2005-08, All rights reserved