I have a form that creates folders according to sites then output reports into those folders. I am pulling info. out of my query. I have two fields that I am pulling the date from. The criteria of the first field is
Code:
Between [Forms]![dlgMonthlyReport]![txtStartDate] And [Forms]![dlgMonthlyReport]![txtEndDate]
The criteria for the second field is the same except it is placed in the OR of the query.

The form works fine if I have the code (criteria) in the first query is by itself.

The problem I get is the second criteria (OR). When I place the code inside that query then run my form the reports do not get seperated.

The code in my form looks like so:
Code:
Set db = CurrentDb()
Set rstSites = db.OpenRecordset("zqrySite", dbOpenDynaset)
rstSites.MoveFirst
Do While Not rstSites.EOF
    Me!txtSite = rstSites("GenAlias")
    DoEvents
    strSQL = "select count (*) as cnt from zqryBillingReportQuery"
    Set qdf = db.CreateQueryDef("", strSQL)
    qdf.Parameters("[Forms]![dlgMonthlyReport]![txtStartDate]").Value = Me!txtStartDate
    qdf.Parameters("[Forms]![dlgMonthlyReport]![txtEndDate]").Value = Me!txtEndDate
    qdf.Parameters("[Forms]![dlgMonthlyReport]![txtSite]").Value = Me!txtSite
    Set rst = qdf.OpenRecordset(dbOpenDynaset)
    rst.MoveFirst
    intCount = rst("cnt")
    rst.Close
    Set rst = Nothing
    Set qdf = Nothing
    If intCount > 0 Then
        DoCmd.OutputTo acOutputReport, "zSRI BILLING REPORT", acFormatRTF, Me!txtLocation & _
                        Me!txtSite & ".rtf"
    End If
    rstSites.MoveNext
Loop