Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default using visual basic to access a protected DB

I tried the code below, and I keep getting a syntax
error. Can anyone help out?
-----Original Message-----
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.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default using visual basic to access a protected DB

You need "Microsoft ActiveX Data Objects 2.0 Library" or higher in the
references of the VBAProject.


"Shin" wrote in message
...
I tried the code below, and I keep getting a syntax
error. Can anyone help out?
-----Original Message-----
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.


.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I access Visual Basic in Excel 2007 Trial? RandyS Setting up and Configuration of Excel 1 April 2nd 07 12:18 AM
visual basic within Access If...Then arabella79 Excel Discussion (Misc queries) 1 October 5th 06 09:34 PM
visual basic within Access If...Then arabella79 Excel Discussion (Misc queries) 0 October 5th 06 09:24 PM
Trust access to visual basic project in XP systems kasi Excel Discussion (Misc queries) 5 October 13th 05 01:32 PM
Trust access to visual basic project greyed out Amit Shanker Excel Discussion (Misc queries) 2 March 5th 05 09:41 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"