Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6.0 and Access 1

Status
Not open for further replies.

Dangerous

Programmer
Aug 31, 1999
6
0
0
GB
I am writing a VB application based around an Access database, i would like to be able to password protect the database so that it cannot be tampered with, other than by somebody trained upon the background workings of it. Whenever i try to run the application it keeps coming up with "Invalid Password Entry" whenever a database call is required and crashes the application.<br>
<br>
My coding to access the databases is as follows,<br>
<br>
dim ws as workspace<br>
dim db as database<br>
dim rs as recordset<br>
<br>
set ws = workspaces(0)<br>
set db = ws.opendatabase( &lt;&lt; database filename &gt;&gt; ) Rem This is where it crashes.<br>
set rs = db.openrecordset( &lt;&lt; table name &gt;&gt; )<br>
<br>
I would like to keep this coding, but if i have to rewrite then i will. How do i amend this to include the password for the database, in order that i can successfully open it.
 
Dangerous -<br>
<br>
Here is part of the login dialog from the VisData project:<br>
<br>
DBEngine.DefaultUser = txtLoginName.Text<br>
DBEngine.DefaultPassword = txtPassword.Text<br>
Set wsp = DBEngine.CreateWorkspace("MainWS", txtLoginName.Text, txtPassword.Text)<br>
<br>
Hope this helps.<br>
Chip H.<br>

 
<br>
set db = ws.opendatabase("yourdata",,,"Ms Access *.mdb;PWD=;")<br>

 
Cheers Hug,<br>
<br>
Looks like this is what i have been looking for. However one small question, in your reply you have included "yourdata"... in the opendatabase line, what is this. Is it my user id to log in to the access database or what?<br>
<br>
Again thanks for you help, just this one tiny thing left now.<br>
<br>
Cheers, Dangerous.<br>

 
I am using the following line

Set db = Workspaces(0).OpenDatabase(locale + &quot;\vbft.mdb&quot;, , , &quot;Ms Access *.mdb;PWD=password;&quot;)

to access my database as you pointed out in this thread, but it keeps on coming up with &quot;Not A Valid Password.&quot;

Any ideas why?

Thanks, DeltaFlyer
The Only Programmer To Crash With Style. LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top