Solved

opening a secured Access table through VB5

Posted on 1998-06-16
3
140 Views
Last Modified: 2010-05-03
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
Comment
Question by:smolloy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
yronnen earned 50 total points
ID: 1463455
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
 
LVL 5

Expert Comment

by:yronnen
ID: 1463456
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
 

Author Comment

by:smolloy
ID: 1463457
Just what I was looking for Thanks
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question