Results 1 to 5 of 5
  1. #1
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142

    display data in the combo box based on values in the table

    Hello Everyone
    I need a help on this.
    I have three Combo boxes.
    and four tables.
    Combo Box:
    1. Element
    2. Project
    3. Employee

    Table:
    1. Element_tbl
    2. Project_tbl
    3. Emplyee_tbl
    4. EmpToProj_tbl

    First, the user selects an item from element combo box.
    after update, it re queries the Project combo box.
    here, the user have access to all the elements and all the projects.

    Now, what my requirement is,
    there are certain employees placed on specific projects. Only they should have access to those projects.
    so what I wanted to check is, if the employee is present on the EmpToProj_tbl, then only those employees should have access to the projects mentioned in the table.
    Rest of them should have access to other projects except the one in the EmpToProj_tbl.



    I understand what to do. But not sure how to proceed it.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    your
    EmpToProj_tbl would have those people assigned to the project,
    when a user want to open the project, check the list to see if they are allowed (in form)
    get their userID at form open,


    Code:
    sub Form_Load()
    dim vUserID
    dim bIsAllowed as boolean
     'get user id
    vUserID = Environ("Username")
     'see if user can open this project
    bIsAllowed =Not IsNull( Dlookup("[userID]" , "EmpToProj_tbl","[UserID]='" & vUserID & "' and [ProjID]=" & cboProj) )
    btnOpenProj.enabled = bIsAllowed
    end sub

  3. #3
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142
    I tried this one.
    But its throwing an error on the
    Code:
    btnOpenProj.enabled = bIsAllowed


    Quote Originally Posted by ranman256 View Post
    your
    EmpToProj_tbl would have those people assigned to the project,
    when a user want to open the project, check the list to see if they are allowed (in form)
    get their userID at form open,


    Code:
    sub Form_Load()
    dim vUserID
    dim bIsAllowed as boolean
     'get user id
    vUserID = Environ("Username")
     'see if user can open this project
    bIsAllowed =Not IsNull( Dlookup("[userID]" , "EmpToProj_tbl","[UserID]='" & vUserID & "' and [ProjID]=" & cboProj) )
    btnOpenProj.enabled = bIsAllowed
    end sub

  4. #4
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142
    What is the btnOpenProj means?
    Is it my combo box for the project?


    Quote Originally Posted by ranman256 View Post
    your
    EmpToProj_tbl would have those people assigned to the project,
    when a user want to open the project, check the list to see if they are allowed (in form)
    get their userID at form open,


    Code:
    sub Form_Load()
    dim vUserID
    dim bIsAllowed as boolean
     'get user id
    vUserID = Environ("Username")
     'see if user can open this project
    bIsAllowed =Not IsNull( Dlookup("[userID]" , "EmpToProj_tbl","[UserID]='" & vUserID & "' and [ProjID]=" & cboProj) )
    btnOpenProj.enabled = bIsAllowed
    end sub

  5. #5
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142
    I have attached the Db for reference.
    In DB.
    All the three employees should have access to all the projects except. Project ID 3.
    Only the Employee ID 3 have access to that and all the rest of the projects.Test.zip

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 11-16-2016, 08:14 PM
  2. Replies: 2
    Last Post: 06-29-2016, 09:37 AM
  3. Replies: 6
    Last Post: 04-04-2015, 08:10 AM
  4. Replies: 1
    Last Post: 03-27-2010, 06:13 AM
  5. Replies: 3
    Last Post: 10-23-2008, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums