• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

opening a secured Access table through VB5

I have a program that access students marks. I want to create user security on different objects in the database. How do I pass the user name and password to access from VB to access the table.  
0
smolloy
Asked:
smolloy
  • 2
1 Solution
 
yronnenCommented:
You can use security with Access databases with visual basic. In fact, you can use multiple levels of security.

Suppose you have a user called "user1" with password "pw1". Write the following code:

DIM WS as Workspace
dim DB as Database
set WS=DBEngine.CreateWorkSpace("MyWS","User1","pw1")
set DB=WS.OpenDatabase("MyDB.mdb")

The DB database will have the permission you've given to user1.
0
 
yronnenCommented:
A little note:You must also point to the system database (the one that holds the users and groups information). This is shown blow:

write this code just below the declarations
DBEngine.SystemDB "system.mdw"

0
 
smolloyAuthor Commented:
Just what I was looking for Thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now