I am working on a Microsoft Access 2003 application that connects to a user defined Workgroup file. Are there any API calls I can use to perform password changes on this file whilst the application is running?
Have a look at the ChangePass sub in this set of routines. I have posted the rest as they may come in handy too...
Option Compare Database
Option Explicit
'Contains procedures to manage MS Access security via VB.
'Uses Jet 4 ANSI-92 extensions (for simplicity) accessible via SQL so will only work in
'MS Access 2000 or later.
'Written by Ed Metcalfe, 28/11/2002.
Public Sub CreateUser(ByVal strUserName As String, ByVal strPWord As String, ByVal lngPID As Long)
Public Sub AddToGroup(ByVal strUserName As String, ByVal strGroupName As String)
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
cnn.Execute "ADD USER " & strUserName & " TO " & strGroupName & ";"
cnn.Close
Set cnn = Nothing
End Sub
Public Sub RemoveFromGroup(ByVal strUserName As String, ByVal strGroupName As String)
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
cnn.Execute "DROP USER " & strUserName & " FROM " & strGroupName
cnn.Close
Set cnn = Nothing
End Sub
Public Sub DeleteUser(ByVal strUserName As String)
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
cnn.Execute "DROP USER " & strUserName & ";"
cnn.Close
Set cnn = Nothing
End Sub
Public Sub DeleteGroup(ByVal strGroupName As String)
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
cnn.Execute "DROP GROUP " & strGroupName & ";"
cnn.Close
Set cnn = Nothing
End Sub
Public Sub AssignPermission(ByVal strAction As String, ByVal strPermissionName As String, ByVal strObjectName As String, ByVal strObjectType As String, ByVal strAccountName As String)
'strAction - GRANT Or REVOKE
'strPermissionName - SELECT, DELETE, INSERT, UPDATE, DROP, SELECTSECURITY, UPDATESECURITY,
'DBPASSWORD, UPDATEIDENTITY, CREATE, SELECTSCHEMA, SCHEMA, UPDATEOWNER
'strObject Name - Name of table/form/report etc.
'strObjectType - "TABLE", "OBJECT" OR "CONTAINER"
'strAccountName - name of user or group
'How do you give design privs then??
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Select Case strAction
Case "GRANT"
cnn.Execute "GRANT " & strPermissionName & " ON " & strObjectType & " " & strObjectName & " TO " & strAccountName & ";"
Case "REVOKE"
cnn.Execute "REVOKE " & strPermissionName & " ON " & strObjectType & " " & strObjectName & " FROM " & strAccountName & ";"
End Select
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.