Connecting to (passworded) Access 97 from VB

A

Arthur Flood

What is the code to connect to Access 97
from VB. The Access 97 file has the password "CORVETTE"

Below is the code that I would normally use.
What changes would have to be made to my VB code, if
my Access database has the password "CORVETTE"

Public DB1 As Database
Set DB1 = OpenDatabase("C:\TEMP\EMPLOYEES")
 
B

Bruce M. Thompson

What is the code to connect to Access 97
from VB. The Access 97 file has the password "CORVETTE"

Below is the code that I would normally use.
What changes would have to be made to my VB code, if
my Access database has the password "CORVETTE"


Public DB1 As Database
Set DB1 = OpenDatabase("C:\TEMP\EMPLOYEES")

Try:

Set DB1 = OpenDatabase("c:\MyData\MyData.mdb", _
False, False, ";pwd=CORVETTE")
 
B

Bruce M. Thompson

Set DB1 = OpenDatabase("c:\MyData\MyData.mdb", _
False, False, ";pwd=CORVETTE")

Sorry, that's:

Set DB1 = OpenDatabase("C:\TEMP\EMPLOYEES"_
False, False, ";pwd=CORVETTE")
 
D

Douglas J. Steele

Bruce M. Thompson said:
Sorry, that's:

Set DB1 = OpenDatabase("C:\TEMP\EMPLOYEES"_
False, False, ";pwd=CORVETTE")

Actually, it's

Set DB1 = OpenDatabase("C:\TEMP\EMPLOYEES", _
False, False, ";pwd=CORVETTE")

(you forgot the comma after the database name)
 
B

Bruce M. Thompson

Set DB1 = OpenDatabase("C:\TEMP\EMPLOYEES", _
False, False, ";pwd=CORVETTE")

(you forgot the comma after the database name)

Oops! Thanks Doug. <g>
 

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