473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Delete User refresh only after restarting Access

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.Refre sh
end sub
..
Nov 13 '05 #1
2 2769
Adding and deleting users (as well as changing permissions) is
something best left to the owner/administrator of the database, not
the users themselves. If the user accidently deletes themselves, then
what?

Also, instead of deleting users, maybe add a Yes/No field to your
table to keep track of whether the user is active or not. This way if
they are deleted and you need to add it again later, all the
information for that user is still there, just go change the active
user field for that user.

di*@hotmail.co.il (Doron) wrote in message news:<e9***********************@posting.google.com >...
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.Refre sh
end sub
.

Nov 13 '05 #2
On 6 Oct 2004 03:33:31 -0700, di*@hotmail.co.il (Doron) wrote:
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.Refre sh
end sub
.

Hi
I tried this and it worked for me, even without the refreshes and
idle.
However, even if it doesn't refresh your current workspace, does this
matter? The user would be unable to log on or be used by any other new
instance of Access.
On Error Resume Next is a bit blunt, I would limit it to the statement
which needs it.
David
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cbielich | last post by:
Here is my problem I create new db in access Link tables from a MySQL server on remote machine to access As long as I dont close access everything works fine. As soon as I close access and...
3
by: Danny Ni | last post by:
Hi, Is there a way to initialize an user control after it's loaded? I know this is a strange question, so allow me to elaborate, I have an user control which allow users to enter customer data and...
3
by: Funky | last post by:
Hi, I have developed an ASP.NET application which has been running in production for around 3 months without any major glitches. Recently, a user was attempting to upload a rather large CSV file...
1
by: Winshent | last post by:
How do you update a user control after a button click event. I have a simple shopping basket user control. If a customer updates their basket, then user control should reflect the number of items...
0
by: Rocky | last post by:
How can list and delete user profiles on a remote machine that is in AD via a asp.net webform using vb.net?
3
by: jb | last post by:
Good morning, I've an application with asp 1.1. In this version of asp.net there wasn't masterpages, then... I was using user controls. After running the update wizard, in vs2005, i get...
4
by: Andrea Scharfe | last post by:
Hi there, I am writing a PHP script which generates some charts using gnuplot. This generates quite a large number of temporary image files. My problem is that I do not know how to delete these...
5
by: merawa | last post by:
I'm working on a project based in Windows Forms, and I need to open the user email after the user enter his user name and password into textboxes and click the open button. I'm not able to open the...
0
by: =?Utf-8?B?U3Bhcmt5?= | last post by:
This is a common problem which has a bunch of mediocre solutions - e.g.: http://dotnetjunkies.com/WebLog/mjordan/archive/2004/02/17/7393.aspx http://www.codeproject.com/KB/aspnet/SyncControl.aspx...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.