Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

deleting records

Posted on 2002-03-16
2
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Suggested Courses

704 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