deleting users using VBA

S

Sirocco

Is it possible to delete users from the Access Workgroup file using VBA? I
want to do a lot and the User and Group Accounts window in Access is very
tedious, designed more for adding/deleting a few names at a time.

Thanks in advance.
 
S

Sirocco

Thanks, but how do I implement this? In other words, how do I feed it the
user names to delete?
 
J

John W. Vinson

Thanks, but how do I implement this? In other words, how do I feed it the
user names to delete?

Presumably you have a query which returns the list of usernames? If so, just
open a recordset based on the query and call the function for each username:

Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset(qryOldUsernames)
Do While Not rs.EOF
Call DeleteUser(rs!Username)
rs.MoveNext
Loop
rs.Close
Set rs = Nothing


John W. Vinson [MVP]
 
S

Sirocco

When I list the usernames in the immediate window, I only get usernames
starting with the letter e. Is there a limit to how many lines will display
in the immediate window?

On a related note, how can I get the usernames using a query?

Thanks.
 
J

John W. Vinson

When I list the usernames in the immediate window, I only get usernames
starting with the letter e. Is there a limit to how many lines will display
in the immediate window?

Several hundred... I really don't know the limit, but the code below doesn't
display ANYTHING in the immediate window. Please post your code.
On a related note, how can I get the usernames using a query?

Ummm... from the table containing the usernames that you want to change??? How
will you determine which users to keep and which to delete if you don't have a
list of names?

John W. Vinson [MVP]
 
Top