Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

How launch proper form depending on user's login

Am working with an old Access database which utilizes Users and Groups Permissions.

Is there a way to make one of two forms open when the user logs in depending on that user's login?

I'm already using this code to determine the user:

If DBEngine.Workspaces(0).Users(CurrentUser).Name = "Shop" Then
blah, blah, blah
end if

If the user is "Shop" then I want a particular form to open.  If it's any other user then I want another particular form to open.

--Steve
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

If DBEngine.Workspaces(0).Users(CurrentUser).Name = "Shop" Then

    docmd.openform "form1"

else

       docmd.openform "form2"
end if
Avatar of SteveL13

ASKER

Where would this code go?  In the inopen event of form2?

(I'm not at my computer now or I would try it)
you can place the code in a click event of a button in your login form.
The login form is the "canned" login form from MS using Users and Groups.  I'm not sure I have control over it, do I?
where is this code located

If DBEngine.Workspaces(0).Users(CurrentUser).Name = "Shop" Then
blah, blah, blah
end if
On a form that is launched from a dashboard "Main Menu" named frmMainMenu.  frmMainMenu is opened by default as determined by File/Options/Current Database/Display Form.
do you want to open either "form1" or "form2"  from frmMainMenu ?
That's not what should work.  The way I need it to work is to have either form1 OR form2 open depending on the user login.

If the user is "shop" then form2 should open.  That would be their Main Menu or dashboard.

If the user is any other than "shop" then form1 should open.  That would be their Main Menu or dashboard.
do you have a form that opens before the "Dashboard" is shown?
Yes...  frmMenuLauncher
Can you edit the form?
Yes.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial