macro using CurrentUser()

mk0920

Registered User.
Local time
Today, 07:56
Joined
Jun 22, 2010
Messages
12
Making progress on my first database. Using 2003 with security. I want to display form based on current user. My thought is to do a macro with the following conditions:
Condition
CurrentUser()=[BOB] Or CurrentUser()=[CONNIE] Or CurrentUser()=[ENIS]
Action
Openform (with the specific form for these users)
Stopmacro
Condition
CurrentUser()=[MIKE] Or CurrentUser()=[MARY]
Action
Openform (with the specific form for these users)
Stopmacro
CurrentUser()=[BELINDA] Or CurrentUser()=[TINA] Or CurrentUser()=[DENISE] Or CurrentUser()=[NANCY]
Action
Msgbox with message telling these users access denied

I am sure there is a cleaner way to do this, but this is my first macro. Would like to do by user group, but couldn't find a function for this. Now the button on the switchboard which is using this macro returns an error message. "there was an error executing the command":confused:
 
You don't use square brackets you use double quotes:

CurrentUser()="BOB" etc.
 
Imagine that. Something that simple! Thank you so much.

:DOne more related question. I now want to display certain toolbars based on user which I assume would follow the same format. How about hiding the database window for certain users? I have only found info to hide for all and then when I want to get to it, I can't.
 
You don't use square brackets you use double quotes:

CurrentUser()="BOB" etc.
Hmm.... I wonder why Bob chose the "Bob" example???:D

@mk0920: Are you referring to this thread? What you should be doing is looking for which group they belong to. Have a search on the forum for this topic.
 
Re: macro using CurrentUser() to hide database window

ANY INFO ON THIS POST FROM YESTERDAY? I AM ON DEADLINE TO FINISH THIS PROJECT BY THE END OF THE WEEK. THANKS! PLEASE READ BELOW:

The closed thread that you refer to is very helpful. However, since I am a complete newbie, I need a little more hand holding! I do want to hide the database window, but only for certain users. What would the syntax be for this?

For CurrentUser()="TINA" or CurrentUser()="BOB"
DoCmd.SelectObject acTable,,True
DoCmd.RunCommand acCmdWindowHide

Where would I put this code? On the open event of the main switchboard?

Is there a function similar to CurrentUser that identifies group? Like CurrentGroup?

Any help would be greatly appreciated
 
Last edited:

Users who are viewing this thread

Back
Top Bottom