Delete User refresh only after restarting Access

D

Doron

Hi all

I need to Delete a user from a database open with user that
do not have permision to do so
I have created a function that will create new workspace
with UserName and Password of one that can
The function run O.K.
But the deleted user is only realy deleted after I restart
access
I don't know how to refresh the main workspace with
changes I made in the new workspace

Can you please help

Here is My Function

Sub DeleteUserFromGroupUser(sUserName As String)
Dim wrkDefault As Workspace, sName As String
Dim grpTemp As Group

On Error Resume Next
Set wrkDefault = DBEngine.CreateWorkspace
("test", "SuperUser", "Password")
Set grpTemp = wrkDefault.Groups("users")

'Remove User From Users Group
grpTemp.Users.Delete sUserName
grpTemp.Users.Refresh

'Remove User From Workgroup
wrkDefault.Users.Delete sUserName
wrkDefault.Users.Refresh
DBEngine.Idle

Set grpTemp = Nothing
wrkDefault.Close
Set wrkDefault = Nothing
DBEngine.Workspaces(0).Users.Refresh
DBEngine.Workspaces(0).Groups("users").Users.Refresh
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top