• Date Range In A Report (Access 2000)

    Author
    Topic
    #403128

    I have a report that where I want the starting and ending dates to be determined based on user input on a form. The between statement works fine when both the starting and ending date fields have been filled out, however I would like more flexibility. What I’d like is to handle each of these scenarios:

    If the user leaves both date fields blank on the form, I’d like to show all records.
    If the user enters only the starting date, I’d like to show all records >= the starting date.
    If the user enters only the ending date, I’d like to show all records <= the ending date.
    If the user enters both a starting and ending date, show all records between those dates.

    Thanks!
    Vernon

    Viewing 1 reply thread
    Author
    Replies
    • #808131

      Say that your controls are named txtStartDate and txtEndDate on a from frmSelect, and that your date field is named DateField. Use this as WhereCondition in DoCmd.OpenReport, or in the WHERE clause of a query:

      ([Forms]![frmSelect]![txtStartDate]=[DateField] Or [Forms]![frmSelect]![txtEndDate] Is Null)

    • #808132

      Say that your controls are named txtStartDate and txtEndDate on a from frmSelect, and that your date field is named DateField. Use this as WhereCondition in DoCmd.OpenReport, or in the WHERE clause of a query:

      ([Forms]![frmSelect]![txtStartDate]=[DateField] Or [Forms]![frmSelect]![txtEndDate] Is Null)

    Viewing 1 reply thread
    Reply To: Date Range In A Report (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: