HandsOn Granting Permissions for Tables to an Existing Group

This hands-on requires prior completion of Hands-On 22-5.

1. Switch to the Visual Basic Editor window and insert a new module.

2. In the module's Code window, enter the SetTblPermissions procedure as shown below.

Sub SetTblPermissions()

Dim conn As ADODB.Connection

On Error GoTo ErrorHandler

Set conn = CurrentProject.Connection conn.Execute "GRANT SELECT, DELETE, INSERT, " _ & "UPDATE ON CONTAINER TABLES TO Mozart" ExitHere:

If Not conn Is Nothing Then

If conn.State = adStateOpen Then conn.Close End If

Set conn = Nothing Exit Sub ErrorHandler:

MsgBox Err.Number & ":" & Err.Description Resume ExitHere End Sub

Programming with the Jet Data Definition Language

Figure 22-2: You can open the User and Group Permissions window (choose Tools | Security | User and Group Permissions) to check out the privileges granted to the members of the Mozart group by the SetTblPermissions procedure in Hands-On 22-9.

0 0

Post a comment