Solved

deleting records

Posted on 2002-03-16
2
162 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

685 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