Solved

deleting records

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

759 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

18 Experts available now in Live!

Get 1:1 Help Now