Results 1 to 7 of 7
  1. #1
    dargo72 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2012
    Posts
    53

    Dropdown Box Selection to Filter Report Output

    I am trying to run a report based upon criteria selected from a combo box on a Form.



    Specifically, I have a report called "Items Assigned To Me" which has a field called "Assigned to"

    I made an unbound combo box on a form that pulls peoples names from a separate table.

    I would like to click on a button next to the Drop Down and have the report show only records related to the name selected in the dropdown.

    I do not know how to do this. Also, do I need a query as an intermediary?

    Thank you,

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can use this method:

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dargo72 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2012
    Posts
    53
    Quote Originally Posted by pbaldy View Post
    You can use this method:

    BaldyWeb wherecondition
    Thank you. The button does open the report (in preview mode) but populates all fields with "Name#"

    Here is the code I used with the button.

    Private Sub Command23_Click()
    DoCmd.OpenReport "Items Assigned To Me Report", acViewPreview, "Assigned to = '" & Me.SelectionBox & "'"
    End Sub

    Any Thoughts? Do I have to do anything on the report end of things?

    Thank you,

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I think you have it in the wrong position. You also need to bracket the field name with the inadvisable space. Try

    DoCmd.OpenReport "Items Assigned To Me Report", acViewPreview,, "[Assigned to] = '" & Me.SelectionBox & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    dargo72 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2012
    Posts
    53
    Quote Originally Posted by pbaldy View Post
    I think you have it in the wrong position. You also need to bracket the field name with the inadvisable space. Try

    DoCmd.OpenReport "Items Assigned To Me Report", acViewPreview,, "[Assigned to] = '" & Me.SelectionBox & "'"
    Still the same result, report runs but shows "Nam#"" in all fields. Do I need to put anything for the datasource for the report?

  6. #6
    dargo72 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2012
    Posts
    53
    Quote Originally Posted by dargo72 View Post
    Still the same result, report runs but shows "Nam#"" in all fields. Do I need to put anything for the datasource for the report?
    Got it! I had to use the original query as the datasource, but allow filters.

    Thank you!

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, I thought you already had the report working. Glad you got it sorted out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 08-29-2012, 10:53 PM
  2. Replies: 6
    Last Post: 05-24-2012, 11:07 AM
  3. Replies: 3
    Last Post: 10-31-2011, 04:54 PM
  4. Form dropdown selection
    By piper in forum Forms
    Replies: 2
    Last Post: 04-16-2011, 09:34 AM
  5. Replies: 19
    Last Post: 05-12-2009, 02:59 PM

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