Makeing at least one record required! Re-post

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an employee information form that has a yes/no checkbox for the
employee to be an administrator. There must always be at least 1
administrator or they will not be able to login to the options section(which
is where the employee form link is located). What would you put in the
beforeupdate section to not allow a user to save a record unless there is at
least 1 admin?

thanx

Reply:
James,

This could not happen with a new employee record, right? This could
only happen if you are editing the record for an existing employee who
happens to be the only currently assigned Admin, and you remove the
admin status from this person. Do I understand correctly?

Response:
Correct. The database is started with an employee record called admin with
the admin check box = true. I want them to be able to delete the admin
record but only if one or more records has the admin check box = true.
 
James

Are you saying that you want to prevent any records until an administrator
is in the database? Uhmmm, how does the administrator get in there, then?
<g>

If you wrote some code to count the number of rows with the Admin checked,
you could use this to confirm the presence of at least one...
 
First, thank you for all of your help!
So how would you count the rows?

I tried this code but it doesn't work correctly. No matter how many are
checked it pulls up the msgbox that show you must have at least 1 admin. I
think it's in the DSum.
 
James

Try creating a Totals query, counting the rows WHERE Admin = True (or how
ever you've set that up). You can then press the Design button to look at
the SQL statement.
 
Back
Top