Results 1 to 4 of 4
  1. #1
    TheProfessorIII is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    10

    Unhappy General Report question - Drop Down

    I have a query that I created from a table.
    Basic info in table (for example) - 5 fields:
    Date, Name, Amount 1, Amount 2, Amount 3


    Multiple entries for same person....
    (Name, btw, is a drop-down combo box)

    In a report, I am grouping by name, then by date, then summing the amounts.
    Mike Smith, for example, has many entries, appearing on multiple pages.
    How can I add a drop-down to the report, or some type of functionality that allows the end-user to select a name from a drop-down and only see Mike Smith's data? The drop down can appear when the end-user clicks on the button to launch the report, or, can be after the entire report is run - I don't care. Any suggestions would be appreciated. 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,640
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    TheProfessorIII is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    10
    Thanks for this - it helped allot. One last question. How do I add a 'close form' command to the below? So basically, when i click the button to run report, I want it to close the current form before i open the report.


    Private Sub cmdOpenReport_Click()
    On Error GoTo Err_cmdOpenReport_Click
    Dim strWhere As String
    Dim ctl As Control
    Dim varItem As Variant
    'make sure a selection has been made
    If Me.Name2.ItemsSelected.Count = 0 Then
    MsgBox "Must select at least 1 Name"
    Exit Sub
    End If
    'add selected values to string
    Set ctl = Me.Name2
    For Each varItem In ctl.ItemsSelected
    strWhere = strWhere & """" & ctl.ItemData(varItem) & ""","
    Next varItem
    'trim trailing comma
    strWhere = Left(strWhere, Len(strWhere) - 1)

    'open the report, restricted to the selected items
    DoCmd.OpenForm "Report", , , "NAME IN (" & strWhere & ")"
    Exit_cmdOpenReport_Click:
    Exit Sub
    Err_cmdOpenReport_Click:
    MsgBox Err.Description
    Resume Exit_cmdOpenReport_Click
    End Sub

  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,640
    Check out

    DoCmd.Close

    in VBA help, noting the available arguments.
    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. General access connectivity question..
    By quahtrader in forum Access
    Replies: 10
    Last Post: 02-25-2010, 08:45 AM
  2. General question
    By dollygg in forum Access
    Replies: 7
    Last Post: 12-11-2009, 05:13 PM
  3. General Database question
    By xyzz in forum Access
    Replies: 3
    Last Post: 05-20-2009, 10:28 AM
  4. General Access Question
    By erose1987 in forum Access
    Replies: 1
    Last Post: 04-01-2009, 12:37 PM
  5. Drop down question.
    By Simon Sweet in forum Forms
    Replies: 4
    Last Post: 02-05-2008, 12:32 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