Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2002
    Posts
    12

    Unhappy Unanswered: How to Launch separate forms based on User

    ive secured my database with the wizard,
    and made 2 test users.. Administrator and test

    test has limited rights no table altering etc
    and admin has everything

    now ive made a main menu form to launch so they can press a button to view a report..

    so ive tried CurrentUser(test) when opening the form
    it does that properly
    but Administrator has to boot mainmenu with CurrentUser(Administrator)
    so when i boot access as user test it launches both same as for admin

    anyone got an idea how to make this multiple?

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    You're going to have to re-state this.

    I'm confused as to what you are trying to do.

  3. #3
    Join Date
    Mar 2002
    Posts
    12

    re

    well ive made a 4 Forms with buttons

    for example

    sales
    purchace
    all
    main menu

    so when i run access .. the username i want user SALES
    to launch the Sales Form not all the forms

    when i run access .. the username Admin i want to launch the form
    main menu ... etc etc

    ive tried to do this with Currentuser(admin) etc but i cant figure out how to rule out other forms ,

    thanks

  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    When you first lauch your program, depending upon the user, you are going to launch a different form. For this, you might use a SELECT statement, as in:

    Code:
    SELECT CASE CurrentUser()
         Case "Sales":             Docmd.OpenForm "frmSales"
         Case "Administrator":     Docmd.OpenForm "frmMainMenu"
         Case Else:                DoCmd OpenForm "frmAll"
    END SELECT
    Is there something beyond this you are looking for?

  5. #5
    Join Date
    Mar 2002
    Posts
    12

    re

    SELECT CASE CurrentUser()
    Case "Sales": Docmd.OpenForm "frmSales"
    Case "Administrator": Docmd.OpenForm "frmMainMenu"
    Case Else: DoCmd OpenForm "frmAll"
    END SELECT

    where in my program do i put this ? new macro / query or form table?

  6. #6
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    I don't know the architecture of your program.

    When the user first launches your program what does he/she get?

    Do you have a startup form, something that simply displays your name, etc. If so that is where you should have this.

  7. #7
    Join Date
    Mar 2002
    Posts
    12

    re:

    launches a macro or query .. so where can i say in the example : the macro autoexecutes (plain access)

  8. #8
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    I'm sorry, but I am having a hard time understanding what is happening here.

    WHen you first launch your program, does it automatically display a form? Or, does it just present you with the database window?

  9. #9
    Join Date
    Mar 2002
    Posts
    12

    re:

    ok , ill explain .. if i start access , ive got my tables | queries | forms and macros |

    just very simple

    so ive made a macro that will start a form

    macroname = autoexec
    form = mainmenu

    the macro executes .. and opens the mainmenu

    in which type of field can i put the select statement?

    if i do this from the macro , it says : unkown expression
    so i need an expression to swap users

    basicly

    if user=sales open form sales
    if user=management open form mt
    if user=director open form mainmenu
    else end

    i just need 1 expression or expression example how to do this in the actual macro

    this is not in visual basic but just in access 2000

    ive tried securing the database which works on 1 local machine (rights to files and forms) which worked but i think this is done locally
    , ive tried it with another PC to access the .mdb file but then the user can do anything... any ideas?

  10. #10
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Your autoexec macro should have a single line in it, and that should be a RunCode action which runs a function in a module.

    In that module, you should have the SELECT CASE statement I gave you in a previous post.

    That's it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •