Results 1 to 3 of 3
  1. #1
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123

    Cascading list boxes

    I have 2 list boxes the first named listFunctions and the Second is listEmp
    using the below code i had the result of when i clicked on the function the same function would be displayed:

    Private Sub ListFunction_AfterUpdate()
    With Me!
    [listEmp]
    If IsNull(Me!listFunction) Then
    .RowSource = ""
    Else


    .RowSource = "SELECT [tblFunctions].[FctnID], [tblFunctions].[FctnDesc]" & _
    "FROM tblFunctions " & _
    "WHERE [tblFunctions].[FctnID]=" & Me!listFunction
    End If
    Call .Requery
    End With
    End Sub

    the info I really want from the listEmp is in the query below. How could I translate this query into the above code
    if at all?

    SELECT tblFunctions.FctnDesc, tblEmpRec.EmpID, tblEmpRec.Name, tblEmpRec.First
    FROM tblFunctions INNER JOIN ((tbl_shift INNER JOIN tblEmpRec ON tbl_shift.ShiftCode = tblEmpRec.Shift) INNER JOIN ratings ON tblEmpRec.EmpID = ratings.EmpId) ON tblFunctions.FctnID = ratings.FctnID
    WHERE (((ratings.FctnID) Like [Forms]![Form1]!
    [ListFunction]))
    ORDER BY tblEmpRec.Name;

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why are you setting listEmp to a RowSource of items from tblFunctions?
    Why does listEmp RowSource need to be ""?

    Could set listEmp RowSource property to:
    SELECT tblEmpRec.EmpID FROM queryname WHERE ratings.FctnID =
    [listFunctions];

    Then the only code needed is:
    Me.listEmp.Requery
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    Great! That makes Life easier
    Thank you

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

Similar Threads

  1. Cascading boxes
    By v!ctor in forum Access
    Replies: 5
    Last Post: 09-01-2013, 06:02 PM
  2. Cascading List Boxes
    By Gee in forum Access
    Replies: 0
    Last Post: 02-13-2013, 10:58 AM
  3. Cascading List Boxes
    By Gee in forum Access
    Replies: 13
    Last Post: 02-07-2013, 01:16 PM
  4. Cascading Combo / List Boxes
    By plowe in forum Programming
    Replies: 5
    Last Post: 09-07-2012, 10:55 AM
  5. Cascading combo boxes
    By combine21 in forum Forms
    Replies: 3
    Last Post: 12-02-2010, 12:57 PM

Tags for this Thread

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