Solved

deleting records

Posted on 2002-03-16
2
159 Views
Last Modified: 2010-05-02
i have a database application where there are two types of users

1. normal user that can only read records
1. Administrator that can do anything

Now when the user tries to login in they type in their username and
password and this is checked in a table in my MS Access database with
a list of all the username and passwords in it. If it is then they get
access to the program.

Now what i would like to know is when users are being deleted from the
program there is some sort of verification that makes sure that there
is at least one person left in the access datbase that has admin rights
otherwise no-one would be able to edit and delete records? There is a
field in this table called "Admin" and it has a checkbox with Yes/No.

i am using the standard data control and its called
datUsers

i also have a variable called IsAdmin which is boolean

Can somebody please tell me how i can do this a sample would be excellent!

0
Comment
Question by:nod31
2 Comments
 

Accepted Solution

by:
GMorgan earned 50 total points
ID: 6871858
whe one goees to delete a user do an IF statement on the recordset to make sure that there is at least one person left with administrator abilities.

("Select * from users where Permission = Administrator")

if users.recordcount > 1 then

'delete the user

else

msgbox "cannot delete last administrator"

end if


0
 
LVL 4

Expert Comment

by:TigerZhao
ID: 6875914
the where clause muse be
  (Admin = Yes) AND (Name <> user_want_delte)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now