View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Tomasura Mike Tomasura is offline
external usenet poster
 
Posts: 32
Default using visual basic to access a protected DB

Try this

You will need the location of the Microsoft Access Workgroup Information
file (.mdw)
A username and password from the Microsoft Access Workgroup Information file



Set objConnection = CreateObject("ADODB.Connection") '
Set objrs = CreateObject("ADODB.Recordset")
objConnection.Provider = "Microsoft.Jet.OLEDB.4.0"

strSQL = "SELECT * "
strSQL = strSQL & "FROM customer "

objConnection.Open "user id = userid; _
data source=c:\data.mdb; _
persist security info = true; _
password = mdwPassword; _
jet oledb:System database=c:\laptop\bci.mdw;"

objrs.Open strSQL, objConnection






"shin" wrote in message
...
I have th following code to connect to an Access DB that
is password protected:

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=S:\ACCTG\RMSys\RMDB.mdb;" & _
"User Id=admin;" & _
"Password=ces"

I get the error message:
Cannot start your application. The workgroup information
file is missingor opened exclusively by another user.

This is not a system DB, it's actually a very simple
databse that I created that is password protected since
it is located on a network drive. I don't want anyone
else opening the database. Can anyone help out? Thanks.