• Can I Do This in Report? ( A2k (9.0.4402) SR-1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Can I Do This in Report? ( A2k (9.0.4402) SR-1)

    Author
    Topic
    #366526

    Can I Do This in Report?

    A2k (9.0.4402) SR-1

    I have a report that prints the operator entered date range in the report page header

    The Text Box: DateHeader control source is as follows:

    =[Forms]![frmCriteriaHP]![txtDateType].[Caption] & ” ” & [Forms]![frmCriteriaHP]![txtStartDate].[Caption] & ” Thru ” & [Forms]![frmCriteriaHP]![txtEndDate].[Caption]

    This works fine when operator enters Start and End Dates,

    Date Range: 01/01/2002 Thru 01/31/2002

    However if date range is not entered (which is OK) Thru prints by itself.

    Date Range: Thru

    Is there a way to wrap an If statement around the control source to test txtStartDate and txtEndDate for no date range and print None instead of Thru?

    Date Range: None

    Command syntax would be helpful.

    Thanks, John Graves

    Viewing 1 reply thread
    Author
    Replies
    • #568608

      Sure, just put an IIF statement in there.

      For example,
      =[Forms]![frmCriteriaHP]![txtDateType].[Caption] & ” ” & [Forms]![frmCriteriaHP]![txtStartDate].[Caption] & IIF(txtStartDate=””,””,” Thru “) & [Forms]![frmCriteriaHP]![txtEndDate].[Caption]

    • #568642

      This can be done more elegantly by including the “thru” in a package with the end date:

      =[Forms]![frmCriteriaHP]![txtDateType].[Caption] & ” ” & [Forms]![frmCriteriaHP]![txtStartDate].[Caption] & (” Thru ” + [Forms]![frmCriteriaHP]![txtEndDate].[Caption])

      Now the “thru” won’t print unless the end date is entered.

    Viewing 1 reply thread
    Reply To: Can I Do This in Report? ( A2k (9.0.4402) SR-1)

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

    Your information: