Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Unanswered: Making combo box invisible based on Permission levels

    My problem:I want to basically open the main menu and from main menu click button which opens a formB on which i want to make few combo boxes as invisible depending upon the level of permission the person has. So I have put above code in the Login form on Ok button but what's happening is its opening both the forms (main menu and formB together) and putting the formB on top instead of main menu. I hope i am able to explain you

    Here is my entire code
    Dim X As Long
    X = Nz(DLookup("UserID", "UserT", "Username='" & txtUsername & "' AND Password='" & txtPassword & "'"))
    'MsgBox "" & X & ""
    If X > 0 Then
    Dim Y As Long
    Y = Nz(DLookup("GroupID", "GroupXUsersT", "UserID='" & X & "'"))

    'We have a valid user
    If Y = 1 Then
    DoCmd.OpenForm "frmmainmenu"
    Forms!frmB!txtUserID = X
    Forms!frmB!txtUsername = txtUsername
    DoCmd.Close acForm, "LoginF"
    End If
    If Y = 2 Then
    DoCmd.OpenForm "frmHomePage"
    DoCmd.OpenForm "frmB"
    Forms!frmB!txtUserID = X
    Forms!frmB!txtUsername = txtUsername
    Forms!frmB!combo1.Visible = False
    DoCmd.Close acForm, "LoginF"

    Please help

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    The best option in my books is to push your dlookup into a function that returns the user permission level and have that as a public function in a code module. Call that function as required in any form or report.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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