Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

deleting records

Posted on 2002-03-16
2
Medium Priority
?
169 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 200 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Suggested Courses

879 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