DAO to check if a user exists

T

Tony_VBACoder

With security applied to an Access 2002 database, how can
I check if a user exists using DAO?
 
J

Joan Wild

Tony_VBACoder said:
With security applied to an Access 2002 database, how can
I check if a user exists using DAO?

Keep in mind that what you are checking is whether the user is in the
workgroup file in use, not the database..
From the security FAQ:

Dim ws as Workspace
Dim StrUser as String
Set ws = DBEngine.Workspaces(0)
On Error Resume Next
strUser = ws.Users("Tony").Name
If Err.Number = 0
'the user exists
Else
'they don't
End If
 
T

Tony_VBACoder

Yes, that is exactly what I wanted.

Thanks

-----Original Message-----


Keep in mind that what you are checking is whether the user is in the
workgroup file in use, not the database..
From the security FAQ:

Dim ws as Workspace
Dim StrUser as String
Set ws = DBEngine.Workspaces(0)
On Error Resume Next
strUser = ws.Users("Tony").Name
If Err.Number = 0
'the user exists
Else
'they don't
End If
--
Joan Wild
Microsoft Access MVP


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top