Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    show database window depending on user (2000)

    I was wondering if any one had a nice snippet of code that checked to see who the user is and loaded the database window or not accordingly (on startup).

    Many thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: show database window depending on user (2000)

    I always hide the database window in databases meant for the end user, and provide a startup form. Depending on the intended use, I may disable F11 as shortcut key for activating the database window.

    You can bypass the startup options by holding down the Shift key while opening the database. (There are ways to prevent this if needed)

  3. #3
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: show database window depending on user (2000)

    Thanks Hans

    That will work for the database window. Part of the reason I asked about depending on user was because I have a form that has several tabs. One of the tabs contains sensitive information and I only want certain users to be able to see it. Is there any way I can check to see who the user is when the form is loaded and then make those controls visible as necessary?

    Many thanks

    Amanda

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: show database window depending on user (2000)

    Yes, the CurrentUser variable holds the login name of the user (it's only useful in a secured database, for in an unsecured database everyone logs in as Admin).

    You could put code in the On Open or On Load event of the form:

    Private Sub Form_Load()
    Select Case CurrentUser
    Case "Tom", "Dick", "Harry"
    Me.SomeTabPage.Visible = True
    Case Else
    Me.SomeTabPage.Visible = False
    End Select
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: show database window depending on user (2000)

    Hans,

    You are truly great. Many thanks - again.

    Amanda

Posting Permissions

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