Q:how to let thru vb progam in password protected access.

how to let thru vb progam in password protected access.

Page 1 of 1

7 Replies - 3336 Views - Last Post: 30 April 2008 - 05:25 AM Rate Topic: -----

#1 mark25  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 15-April 08

Q:how to let thru vb progam in password protected access.

Posted 28 April 2008 - 11:10 AM

Hi All,

i have now a working database program in vb and a database using microsoft access. I want to set a password in Microsoft Access so that all users cannot view the database except thru the vb program as their medium.

Before placing a password in Microsoft acess:
When there is no password on my access database it is working 100% successfully.

After placing a password in Microsoft acess:
But when i placed a password on my db, and when i am running the program and click the button that will open the database it says Not a valid password making the program crash(You can see on the attached).


My security access on database access is let say for example: "mark25"
All i want is for the VB program to pass "mark25" automatically so that it can get in.

Here is my code on my module.

Public Sub open_conn()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & (App.Path & "\mdbInventory.mdb") & ";Persist Security Info=True"
cn.Open
End Sub

i just want the database access to block the user when the user opens it without using the program.
But when the user uses the program it's ok so that the records are safe for deletion.
this is like access rights thing.

Please help to hardcode "mark25" in my vb prog!


thanks and regards!

Attached image(s)

  • Attached Image

This post has been edited by mark25: 28 April 2008 - 11:13 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Q:how to let thru vb progam in password protected access.

#2 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Q:how to let thru vb progam in password protected access.

Posted 28 April 2008 - 11:33 AM

Add "Password=mark25;" in the ConnectionString like this:
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & (App.Path & "\mdbInventory.mdb") & ";Password=mark25;Persist Security Info=True"

Was This Post Helpful? 0
  • +
  • -

#3 mark25  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 15-April 08

Re: Q:how to let thru vb progam in password protected access.

Posted 28 April 2008 - 12:17 PM

View Postborn2c0de, on 28 Apr, 2008 - 11:33 AM, said:

Add "Password=mark25;" in the ConnectionString like this:
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & (App.Path & "\mdbInventory.mdb") & ";Password=mark25;Persist Security Info=True"


Hello Born2code,

I've tried this but it says a new error.

This is the prompt i get.

"Cannot start your application. The workgroup information file is missing or opened exclusively by another user"

There's no application opened other than VB and there's no other pc opened for sharing so i am sure that no ones using the database but me.

Here's how i setup my db in access.

1. File ->Open -> highlighted my file and then clicked on the arror down right next to the open button on the lower left -> Open Exclusively. After the created database has been loaded i clicked Tools -> Security -> Set Database password. It ask me to put password and confirmation so i put "mark25"

Is my procedure on giving password to my db access conflicts with the advice you give? Is there a different way to hardcode mark25 in my program born? Please advice.

This post has been edited by mark25: 28 April 2008 - 12:42 PM

Was This Post Helpful? 0
  • +
  • -

#4 danny_kay1710  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 29
  • View blog
  • Posts: 359
  • Joined: 27-April 08

Re: Q:how to let thru vb progam in password protected access.

Posted 28 April 2008 - 02:01 PM

I might be completely wrong with this but I do remember coming across a similar problem.

Make sure that wherever you store the access database there isn't a .ldb (it may be hidden) and also it depends on how you have set a password.

Since it doesn't seem like you have set up a workgroup i would also say to delete any access workgroup files as well. (Please make a backup of both the database and these files first just in case)

Like I said though this is just a vague memory of troublesome times with Microsoft Access

Danny_kay1710
Was This Post Helpful? 0
  • +
  • -

#5 mark25  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 15-April 08

Re: Q:how to let thru vb progam in password protected access.

Posted 29 April 2008 - 01:17 AM

why? does what born advised only applicable in a different way of setting up a password in Access? I've tried this as well and it didn't work.
Was This Post Helpful? 0
  • +
  • -

#6 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Q:how to let thru vb progam in password protected access.

Posted 29 April 2008 - 07:53 AM

This is interesting.
The method I mentioned universally works with almost all databases I know of.

However, it's a bit different for Access.
There are loads of websites that discuss and solve this problem.
This ConnectionString might work though, give it a shot:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<put source database path here>;Jet.OLEDB:Database password=mark25;"


Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#7 mark25  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 15-April 08

Re: Q:how to let thru vb progam in password protected access.

Posted 29 April 2008 - 12:54 PM

Hello Born!

Thanks! One link works very successful!

The best explanation came from Bob Barrows.

"Since your database is not using workgroup security, you should not be using
a user name and password. It looks as if your database is password-secured
(which is futile security at best)."

If so, your connection string should
look like this:

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Jet OLEDB:Database Password=mark25; Data Source=" & (App.Path & "\mdbInventory.mdb") & ";"

My previous string was like this until i've changed it.

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; User ID=;Password=mark25;Data Source=" & (App.Path & "\mdbInventory.mdb") & ";Persist Security Info=True"

Again, thanks Born you rock!
Was This Post Helpful? 0
  • +
  • -

#8 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Q:how to let thru vb progam in password protected access.

Posted 30 April 2008 - 05:25 AM

Glad to have helped :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1