Solved Want to learn how to add Dates from my Query to a report (1 Viewer)

Umpire

Member
Local time
Today, 05:44
Joined
Mar 24, 2020
Messages
102
I am looking for where to learn how to do this, not have some one do it for me.

Note: Everything I have done so far has been through the built in Access wizards etc. I have written no code.

I have a number of reports that use dates that are put in to the query by Message Box. I have attached a screen shot of one such query section. The reports run just fine and produce the expected results. Want I want to add is the Start Date and End date I enter in the Query to the report.

I know I will probably need to write some code to do it. I just need to be pointed in the right direction to learn what I need to do so I can work on figuring our how to do it.
Thanks
 

Attachments

  • Date Tested.PNG
    Date Tested.PNG
    4.2 KB · Views: 39

plog

Banishment Pending
Local time
Today, 07:44
Joined
May 11, 2011
Messages
10,562
The easy, non-optimal way to do this is by making new fields in your query that uses the input Start and End dates:

StartDate: [Start Date]
EndDate: [End Date]

The harder, better way to do this is by creating a form for users to enter/select dates and then have a button they click that opens your report using a DoCmd.OpenReport (https://docs.microsoft.com/en-us/office/vba/api/access.docmd.openreport) and creates a filter string for it to use with the input dates.
 

Umpire

Member
Local time
Today, 05:44
Joined
Mar 24, 2020
Messages
102
The easy, non-optimal way to do this is by making new fields in your query that uses the input Start and End dates:

StartDate: [Start Date]
EndDate: [End Date]

The harder, better way to do this is by creating a form for users to enter/select dates and then have a button they click that opens your report using a DoCmd.OpenReport (https://docs.microsoft.com/en-us/office/vba/api/access.docmd.openreport) and creates a filter string for it to use with the input dates.
Thank you. The easy way almost worked. When typed as you wrote it I got a circular reference error. I changed it to Begin Date:[Start Date] and Last Date: [End Date] and it worked just fine. This will allow me to put dates on the reports for now.

I like your suggestion of the form for date selection with a button. Defiantly will be implementing that in a future version.
 

Users who are viewing this thread

Top Bottom