The information in this article applies to:
SUMMARYIn Microsoft Visual Basic version 4.0, you can assign permissions to database objects in a program by using data access objects (DAO). This article shows you how. MORE INFORMATIONSteps to Secure DatabaseSecuring a database involves these steps:
Assigning Permissions on Database Objects to Users and GroupsTo assign permissions for an object, you must reference the UserName and Permissions properties of the object's document. All database objects can be treated as documents in a container. For example, suppose you have this DB variable assignment:
A table called Authors can be referred to using DAO as follows:
However, it is usually easier to assign and work with object variables:
You can reference the UserName and Permissions properties of the Table1
document directly by using this code:
-or-
Reading Permissions InformationTo read the permissions that a given user or group has on an object, set the UserName property of the document to that user or group name, and then read the value of the Permissions property.NOTE: To use the following examples, you must already have a database with security established. That is, a SYSTEM.MDA file exists. The following example shows how to read the permissions for the user John on table TestTable: NOTE: Whether you inquire about a group or a user, you still set the
UserName property. There is no GroupName property for a document.
Assigning Permissions InformationTo assign permissions for a user on an object, set the UserName property of the document to the name of the user or group. Then set the Permissions property of the document to the appropriate value.Generally, you should use the predefined constants when you assign permissions. For a complete list of the predefined constants, search under DAO for constants starting with 'dbSec' in the Object Browser. The following example shows how to assign Full permissions on the Employees table for a user named Martha:
Additional query words: 4.00 vb4win vb4all
Keywords : kbcode |
Last Reviewed: August 31, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |