".Groups()" Collection Item not found (3265) on one of several computers only

T

tessa.wier

Hi
I have a password secure jet database shared across a small network.
I am using the following code to determine what group the currentuser
belongs to, in order to run form permissions, and the code works on
every computer but one. It is an Access 2000 database and the
computer with the problem runs Access 2002 (Note: other Access 2002
computers exist and are fine with the code). I have searched for an
answer all over the net. My "References" are fine (even turned off
the ActiveX Data Obejects 2.1 Library as using DA03.6) my database is
not corrupt (on the problem machine I imported everything into a blank
database and tried to run it with no luck). I am lost please help me.

Function IsUserInGroup(strGroup as String, strUser as String) as
Integer
Dim ws as Workspace
Dim grp as Group
Dim strUserName as String

Set ws = DBEngine.CreateWorkspace("Test","Developer","")
Set grp = ws.Groups(strGroup) 'here it states Error 3265: Item not
found in this collection (test Item = "Admins")
On Error Resume Next
StrUsername = grp.Users(struser).Name
IsUserInGroup= (Err=0)
Set ws = Nothign
Set grp = Nothing

End Fucntion
 
6

'69 Camaro

Hi, Tessa.
I am lost please help me.

I see a bunch of typographical errors (and a logic error, too, by the way),
indicating that you did not paste the actual code from the VBA module into
your message. Therefore, we can only guess what your actual code is and
where the problem may be, which is pretty much an exercise in futility.

So, I'll give you a few general suggestions:

1.) Ensure that Option Explicit is declared in the Declarations section of
all of the modules.

2.) Ensure that "Require Variable Declaration" is checked in the "Editor"
tab of the Tools -> Options... menu of the VB Editor.

3.) Compile the code and fix any compilation errors.

4.) Open the Access Tools -> Security -> User and Group Accounts... dialog
window and select the "Groups" tab on the Access 2002 workstation when the
user is logged in. Use the combo box to search for the actual Group name
(which we both know isn't really "Admins"). If this user isn't joined to
the same workgroup as everyone else is, then a different list of groups is
very likely to be found. So, the custom group you expect to find is missing
because no one has created it in the other workgroup that this Access 2002
user is joined to.

5.) Set "grp" to Nothing before setting "ws" to Nothing. "grp" is relying
on "ws" to be in memory.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
T

tessa.wier

Hi, Tessa.


I see a bunch of typographical errors (and a logic error, too, by the way),
indicating that you didnotpaste the actual code from the VBA module into
your message. Therefore, we canonlyguess what your actual code is and
where the problem may be, which is pretty much an exercise in futility.

So, I'll give you a few general suggestions:

1.) Ensure that Option Explicit is declared in the Declarations section of
all of the modules.

2.) Ensure that "Require Variable Declaration" is checked in the "Editor"
tab of the Tools -> Options... menu of the VB Editor.

3.) Compile the code and fix any compilation errors.

4.) Open the Access Tools -> Security -> User and Group Accounts... dialog
window and select the "Groups" tab on the Access 2002 workstation when the
user is logged in. Use the combo box to search for the actual Group name
(which we both know isn't really "Admins"). If this user isn't joined to
the same workgroup as everyone else is, then a different list ofgroupsis
very likely to befound. So, the custom group you expect to find is missing
because noonehas created it in the other workgroup that this Access 2002
user is joined to.

5.) Set "grp" to Nothing before setting "ws" to Nothing. "grp" is relying
on "ws" to be in memory.

HTH.
Gunny

Seehttp://www.QBuilt.comfor all your database needs.
Seehttp://www.Access.QBuilt.comfor Microsoft Access tips and tutorials.
Blogs:www.DataDevilDog.BlogSpot.com,www.D....QBuilt.com/html/expert_contributors2.htmlfor contact
info.









- Show quoted text -

Hi Gunny
Thank you for your reply.
I Replied directly but you email has zero spam in it's address etc so
I'm not sure my email will make it, so, I reply here too.

I typed in the code above looking at the computer beside me so made
some mistakes - woops. I always compile. Otherwise, the "Option
Explicit" and "Require Variable Declaration" were good tips I knew
about but will remember to employ for now on.
Re the "Admins" group search: it is actually one of the groups I am
looking for and it definitely exists! All computers have the most
current WorkGroup file installed and are joined to it.
I have run the Office repair program thinking that Access may have
something out of whack on the problem computer and it did nothing.
The only other thought I have is that the computer uses an Academic
version of Office, but, everything I have read states that there is no
difference. Is this true? Could Access on this problem computer have
some library or something missing? Should I try uninstalling Access
and re-install.
Still in a quandry and needing some bright help.
 
6

'69 Camaro

Hi, Tessa.
I Replied directly but you email has zero spam in it's address

That's to avoid the spambots that harvest E-mail addresses from the
newsgroups. ;-) Anywhere you see ZERO_SPAM in that address, it should be
removed in order to create a valid E-mail address. And that address is
available for those who want to hire a consultant, which I don't think you
need.
I typed in the code above looking at the computer beside me so made
some mistakes - woops.

If the other computer isn't connected to the Internet, then perhaps you can
copy the VBA code and paste it into Notepad and save the file on a floppy,
CD, or USB drive, then carry it to the other computer that is connected to
the Internet, and paste the text from the file in Notepad into your next
message.
Re the "Admins" group search: it is actually one of the groups I am
looking for and it definitely exists!

Yes. It exists in every Workgroup, but the text string being passed may not
be what you think it is. For example, it may have an extra space tacked on
to the end of the string. To determine what's really being passed, place
the following line of code:

Debug.Print "*" & strGroup & "*"

.. . . before this line of code:

Set ws = DBEngine.CreateWorkspace("Test","Developer","")

Also, ensure that "Developer" is a member of the current workgroup and that
he has no password set -- which isn't very secure, is it? If "Developer"
isn't a member of this workgroup, then change the name to a User ID who is
and use that user's password as the third argument in the CreateWorkspace
function. If he has no password, then leave the zero-length string for the
third argument.

Run the code, then check the Immediate Window (press <CTRL><G>) afterwards,
and see if there are any extra spaces or extra characters in the string
between the asterisks. It should look exactly like the following:

*Admins*

If all of the above is in order, and you've followed my earlier suggestions,
then you shouldn't get that error.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

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