473,782 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DeleteUserFromG roupUser(sUserN ame As String)
Dim wrkDefault As Workspace, sName As String
Dim grpTemp As Group

On Error Resume Next
Set wrkDefault = DBEngine.Create Workspace
("test", "SuperUser" , "Password")
Set grpTemp = wrkDefault.Grou ps("users")

'Remove User From Users Group
grpTemp.Users.D elete sUserName
grpTemp.Users.R efresh

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

Set grpTemp = Nothing
wrkDefault.Clos e
Set wrkDefault = Nothing
DBEngine.Worksp aces(0).Users.R efresh
DBEngine.Worksp aces(0).Groups( "users").Users. Refresh
end sub
..
Nov 13 '05 #1
2 2780
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.googl e.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 DeleteUserFromG roupUser(sUserN ame As String)
Dim wrkDefault As Workspace, sName As String
Dim grpTemp As Group

On Error Resume Next
Set wrkDefault = DBEngine.Create Workspace
("test", "SuperUser" , "Password")
Set grpTemp = wrkDefault.Grou ps("users")

'Remove User From Users Group
grpTemp.Users.D elete sUserName
grpTemp.Users.R efresh

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

Set grpTemp = Nothing
wrkDefault.Clos e
Set wrkDefault = Nothing
DBEngine.Worksp aces(0).Users.R efresh
DBEngine.Worksp aces(0).Groups( "users").Users. Refresh
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 DeleteUserFromG roupUser(sUserN ame As String)
Dim wrkDefault As Workspace, sName As String
Dim grpTemp As Group

On Error Resume Next
Set wrkDefault = DBEngine.Create Workspace
("test", "SuperUser" , "Password")
Set grpTemp = wrkDefault.Grou ps("users")

'Remove User From Users Group
grpTemp.Users.D elete sUserName
grpTemp.Users.R efresh

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

Set grpTemp = Nothing
wrkDefault.Clos e
Set wrkDefault = Nothing
DBEngine.Worksp aces(0).Users.R efresh
DBEngine.Worksp aces(0).Groups( "users").Users. Refresh
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
1150
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 restart it again the links no longer work and I have to recreate the links. Does this everytime. HELP!!
3
1923
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 save them into SQL server. The user control has about 50 textboxes and other web controls. To simplify, let's say user control contains a textbox txtCompany and another textbox called txtContact, for the first company, I entered "ABC plumbing"...
3
1784
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 and ran into a strange problem. After roughly 3 minutes of processing, the application reprompted the user for their user name and password (NT authentication). At this point, the ASP.NET page re-fired the last event that it was processing.
1
1824
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 and value of the basket. My code for the basket control is as follows: '################################################### Namespace Web.controls.User
0
1019
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
1333
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 hundreds of error arround user controls, like: - "unknown server tag "uc1:cabecera".
4
3660
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 images after they have been loaded and are already displayed at the website. Everything I have tried so far resulted in that the images were not displayed at all. I already tried something like:
5
1283
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 new e-mail using the "mailto:" technique. so please any one know how to open the mail through this technique or any other techniques tell me. (I need c# code) thank you very much for helping.
0
1051
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 http://www.web-source.net/web_development/form_submission.htm Is there a Microsoft technique to prevent multi-submits? If not, what is the best way to prevent multi-submits when the user clicks refresh after the initial submittal of a form. ...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.