Results 1 to 3 of 3
  1. #1
    pjdube is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2017
    Posts
    25

    Form Button Click to Generate Different Reports, but need option to Select ALL

    Hi everyone!



    So I am almost done with my form and everything works great. There is just one minor thing that I would like to accomplish, and any pointers would be awesome.

    I have a ComboBox that has 3 types of reports in it. Each report is the same and the below VBA filters it by Type. Now I want the full report (not filtered) as an option.

    I thought it would be easy to just put "" as part of the ComboBox and was hoping that the below would just accept it, and give me the full report, but it doesn't.

    Here is the VBA for the Report Button Click, which grabs the value from the ComboBox:


    Code:
    Private Sub ReportBtn_Click()
    
    
    Dim strType As String
    Dim strReportName As String
    strReportName = "TypeDisplay"
    strType = "[Type] = """ & Me.ReportsCbo & """"
    
    
    DoCmd.OpenReport strReportName, acViewPreview, , strType
    
    
    Me.Form.Refresh
    End Sub
    The ComboBox values are:
    East
    West
    North
    South

    Now if I could put "All" or "" in the ComboBox and figure out how to program the above VBA to accept it and produce a FULL REPORT (i.e. East, West, North and South all in one report), then that would smoke!

    Perhaps it is an Else statement or something. Not sure, I am still new at this.

    Thanks!

    Phil

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Could be as simple as:
    Code:
    strType = "[Type] LIKE '" & Me.ReportsCbo  & "*'"
    I prefer single apostrophe to doubled quotes for text delimiter.
    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
    pjdube is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2017
    Posts
    25
    June 7,

    Thank you! Works! I knew it would be very simple!

    Phil

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

Similar Threads

  1. Replies: 6
    Last Post: 11-10-2017, 05:00 PM
  2. Button to Generate Report from Form
    By faythe1215 in forum Forms
    Replies: 14
    Last Post: 02-02-2015, 04:22 PM
  3. Replies: 7
    Last Post: 09-27-2014, 09:11 PM
  4. Replies: 1
    Last Post: 05-05-2011, 09:21 AM
  5. using a Form with combo boxes to generate reports
    By mistervelasco in forum Access
    Replies: 2
    Last Post: 10-28-2009, 03:38 AM

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