use VB to run Access 2000 and open a database with password

  • Thread starter Thanh-Nhan Le \(web.de\)
  • Start date
T

Thanh-Nhan Le \(web.de\)

Hi,
I have an access DB protected with password.
I don't want that the users must type the password, when they open this DB.
My VB program check something more, before it allow a user to open the DB.

I write a VB program, this run Access program with shell function:

SHELL "...\msaccess.exe test.mdb /wrkgrp wrk.mdw /User userxx /pwd xxxxpwd
"

This works, but when the DB hat a password, then I don't know, how can open
it automatically. Is it possible?

Can anybody help me?

Thanks
TNL
 
A

Arvin Meyer

This used to work in Access 97, it will probably work fine in 2000.

Dim db As DAO.Database
Dim ws As DAO.Workspace
Dim strDB As String
Dim strPwd As String

strDB = "C:\Path to database.mdb"
strPwd = ";PWD=Password"
Set db = ws.OpenDatabase(strDB, False, False, strPwd)

The first False tells Access NOT to open exclusive, the second false tells
Access NOT to open Read-Only.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top