Forum Discussion

PetarV's avatar
PetarV
Copper Contributor
Mar 01, 2021

Period of Time on a Report

Hello,

I have a query that gives me totals based on Start and End date. Basically when I open the query a dialog box will open asking for Start and End date, then it gives me the results I need.

My question is: can I get the input (start, end date) visualized like a period in a report: for example [Start Date]=02/01/2021, [End Date]=02/20/2021, then there will be a Time Period on a report that will show [Period]=02/01/2021 - 02/20/2021

Any ideas will be appreciated

Thanks in advance 

  • PetarV 

    The standard method most experienced Access developers use is to launch the query from a form. 

    On that form you place two text box controls: StartDate and EndDate. 

     

    In the query, change that criteria reference from the input boxes to the controls on the form:
    Between Forms!YourFormNameGoesHere.txtStartDate and Forms!YourFormNameGoesHere.TxtEndDate

     

    Now, the query is filtered on open by the values in those controls.

     

    And, your report can ALSO have two controls that reference those same form controls

    =Forms!YourFormNameGoesHere.txtStartDate

    and

    =Forms!YourFormNameGoesHere.TxtEndDate

     

     

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    PetarV 

    The standard method most experienced Access developers use is to launch the query from a form. 

    On that form you place two text box controls: StartDate and EndDate. 

     

    In the query, change that criteria reference from the input boxes to the controls on the form:
    Between Forms!YourFormNameGoesHere.txtStartDate and Forms!YourFormNameGoesHere.TxtEndDate

     

    Now, the query is filtered on open by the values in those controls.

     

    And, your report can ALSO have two controls that reference those same form controls

    =Forms!YourFormNameGoesHere.txtStartDate

    and

    =Forms!YourFormNameGoesHere.TxtEndDate

     

     

Resources