User and Group information

G

Gary Pollard

Access 2000
How do I get user name and workgroup name.

This code worked in Access 97 but Access 2000 object to
Dim grp As Group, usr As User and
Dim strMessage As String

Function MyGroup() As String
Dim grp As Group, usr As User
Dim strMessage As String
Set usr = DBEngine.Workspaces(0).Users(CurrentUser)
For Each grp In usr.Groups
Select Case grp.Name
Case "prod-input"
------- various cases and code ---------
End Select
Next
End Function

Any help appreciated
 
D

Douglas J. Steele

That code uses DAO, and by default, Access 2000 (and 2002, for that matter)
doesn't have a reference set to DAO.
 
D

Douglas J. Steele

Sorry about that: the previous message got sent before I was finished with
it!

As I was saying, that code uses DAO, and by default, Access 2000 (and 2002,
for that matter) doesn't have a reference set to DAO, so you need to set
one.

With any code module open, select Tools | References from the menu bar,
scroll through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, and select it.
 
C

CoyoteV

Hey, Gary.........................long time no see.

Mark
Access 2000
How do I get user name and workgroup name.

This code worked in Access 97 but Access 2000 object to
Dim grp As Group, usr As User and
Dim strMessage As String

Function MyGroup() As String
Dim grp As Group, usr As User
Dim strMessage As String
Set usr = DBEngine.Workspaces(0).Users(CurrentUser)
For Each grp In usr.Groups
Select Case grp.Name
Case "prod-input"
------- various cases and code ---------
End Select
Next
End Function

Any help appreciated
 
G

Gary Pollard

Thanks for your help - it now works

When I started using 2000 I got the impression that DAO was being frawned
upon and code should be updated to avoid using DAO.

Am I wrong?
Is there a better way to find user name and workgroup?
 
D

Douglas J. Steele

Some people have said that, but it's not entirely true.

If you plan to migrate your backend to another platform, then it may make
sense to use ADO, but if all you're using is a Jet database (i.e. an MDB) to
store your data, DAO is still the better way, as it was developed
specifically for Jet. Access 2000 and 2002 didn't have a reference set to
DAO by default, but Microsoft realized their error, and Access 2003
automatically has the reference.

ADO is a generic model, so there are things that it cannot do that DAO can.
For more information, see what Michka's posted at
http://www.trigeminal.com/usenet/usenet025.asp
 

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