dynamic reports from forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacquew
    New Member
    • Jan 2014
    • 1

    dynamic reports from forms

    Hi,
    I'm trying to generate a report off of a form with combo/list boxes that will filter the report parameters. I'm doing this for several forms/reports, but generally need the same thing for all.

    For example, I have a form for my programs which has a combo box "cboYear" to select a year, based off of [progdate] and formatted as "yyyy" so the user can select what year they want their reports from. But, I also have a cascaded combo box "cboProgramTitl e" that is based off of the [progdate] box, and only shows programs selected for the "cboYear". The code below will run the report and filter if something is selected for "cboProgramTitl e", or returns all if left blank. How do I also get it to return all programs for the "cboyear", since this is already a 'formatted' version of [progdate], if a year is selected, but "cboProgramTitl e" is left blank?

    Code:
    Private Sub cmdAttendees_Click()
    If IsNull(Me.cboProgramTitle) Then
       DoCmd.OpenReport "rptProgramAttendees", acViewReport
    Else
       DoCmd.OpenReport "rptProgramAttendees", acViewReport, , "ProgramIDFK = " & cboProgramTitle & ""
    End If
    
    End Sub
    I've attached a sample of my DB, the form in question can be found by clicking the command button in the 'programs/events' tab. I've run into this same problem for the forms/reports in the 'tours' and 'tz' tabs, too. Need help filtering reports off multiple combo/list boxes, with one of them being the year list, or others being month or quarter lists.

    Thanks in advance!
    Attached Files
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Build a dynamic filter string and use that in your open report.

    Comment

    Working...