How To Show Date Range Of Query On Report

B.A.M

Registered User.
Local time
Today, 13:13
Joined
Jul 19, 2012
Messages
20
Hi: Im Tasked With Producing A Report using A Co-Workers DB And I Would Like The Date Range OnThe Header

Im Looking To Show The Dates Picked For The Report
(15-01-11) To (15-01-12) As An Example

Iv Found This..="Report for: " & [Enter date]
But I Would Like It To Be Automated ,Can It Be Done

Im Learning To Create/Edit (But Still Green)

Thanks For The Help
 
Last edited:
Well, your example of

="Report for: " & [Enter date]

would be automated; you just need to use the exact same text as used in the query criteria. If you're using a form for the criteria:

="Report for: " & Forms!FormName.TextboxName
 
Sorry: I Would Like It To Automatically Input The Dates
Without The Additional Entry
Before Generating The Report

Thanks
 
What dates should it automatically input? If the user is entering them, how and where are they doing it?
 
It can be set up automatically in a few ways.

  1. The query would need to create a date range based on todays (or a seed) date. Say 10 days before, or x days either side of the seed date. This way the formulae you use to generate the date criteria can be copied on the report
  2. Have a form with a number of buttons to display the report, each one giving a different date range.
  3. Have 2 textboxes on the report for the date range and set the ControlSources to =Dmin("[DateField]","[ReportQuery]") and the other to =Dmax("[DateField]","[ReportQuery]")
 
option 2: The Report Already Has The Criteria For Input Dates To Be Selected To Produce The Report

Picture Enclosed
 

Attachments

  • Database 3.JPG
    Database 3.JPG
    71.5 KB · Views: 570
in that case you just need a textbox (as Paul suggested) on your report with a controlsource similar to

=Forms!NetCriteria!DateFieldFrom & " to " & Forms!NetCriteria!DateFieldTo
 
Last edited:
Like I mentioned:

="Report for: " & Forms!FormName.TextboxName

would work, and you can obviously concatenate more onto that to get the second date.
 
At It Again 9-5 Here lol

So All I Can Get To Work So Far Is The
="Date Range For Report: " & [Enter Date Range]
Dialog Box

What Im Looking To Do Is Have It Automatically Input The Preseleted Dates Off The Net Critera Form
And Or Have A Default Value If Nothing Selected As "ALL"
In A Perfect World

Am I To Run Somthing Like =[Forms]![NetCriteria]!{DippedDate]![DateFieldFrom] & " to " & [Forms]![NetCriteria]!{DippedDate]![DateFieldTo]
That Dosent Work Bad Values And
=[Forms]![NetCriteria]![DippingDate] & " to " & [Forms]![NetCriteria]![DippingDate]

Hase #Name? On The Report
AS Stated Im A Rookie

Thanks For The Patience
 
What are the names of the textboxes? Your syntax doesn't look right. Does this work?

=[Forms]![NetCriteria]![DateFieldFrom]
 
At It Again 9-5 Here lol

So All I Can Get To Work So Far Is The
="Date Range For Report: " & [Enter Date Range]
Dialog Box

What Im Looking To Do Is Have It Automatically Input The Preseleted Dates Off The Net Critera Form
And Or Have A Default Value If Nothing Selected As "ALL"
In A Perfect World

Am I To Run Somthing Like =[Forms]![NetCriteria]!{DippedDate]![DateFieldFrom] & " to " & [Forms]![NetCriteria]!{DippedDate]![DateFieldTo]
That Dosent Work Bad Values And
=[Forms]![NetCriteria]![DippingDate] & " to " & [Forms]![NetCriteria]![DippingDate]

Hase #Name? On The Report
AS Stated Im A Rookie

Thanks For The Patience

I see a couple of {'s in your code instead of ['s, so you may wish to correct that. The best option for your title is the code everybody's given you.

Code:
="Report for " & [Forms]![NetCriteria]![DippedDate]![DateFieldFrom] & " to " & [Forms]![NetCriteria]![DippedDate]![DateFieldTo]

But if your query has from and to date fields in it already, you can also code it...

Code:
="Report for " & MIN([datefield]) &" to "& MAX([datefield])

Although bear in mind, that won't necessarily give you the two dates the user selected, just the oldest and newest dates in the query the report is based on.

And make sure you're using a Text Box as opposed to a label. The Report Wizard, if you used that, always uses a label for the title of the report.
 
Hi Again..THanks

="Report for: " & [Forms]![sfDipped]![Dippedstart].....Mabe
="Report for: " & [Forms]![sfDipped]![DippedEnd].....Mabe

Or



Text Boxs Are Above
Once I Opened The Net Criteria Form Them Change To Design View I Got The Text Box Names For The Entry Fields (Dates)
 
YO.YO
I Think I Got It
At Least To Automatically Input The Dates
Code Was =[Forms]![NetCriteria]![Dippedstart] & " to " & [Forms]![NetCriteria]![DippedEnd]

Thanks....Again

Any Ideas On How To Have It Default To A Text When No Dates Are Enterd
 
YO.YO
I Think I Got It
At Least To Automatically Input The Dates
Code Was =[Forms]![NetCriteria]![Dippedstart] & " to " & [Forms]![NetCriteria]![DippedEnd]

Thanks....Again

Any Ideas On How To Have It Default To A Text When No Dates Are Enterd

Although it would make your formula longer for the title, you can add an IIF statment to check one of those boxes (DippedStart or DippedEnd) to see if they're null, and if so, write a different title.

Code:
=iif (isnull([Forms]![NetCriteria]![Dippedstart]), "This is my Report", "Report for "&[Forms]![NetCriteria]![Dippedstart] & " to " & [Forms]![NetCriteria]![DippedEnd])
 
You can use the IIf() function to test.
 
I Read What Your Getting At With Nz (Help Files)

The Fomula Is Returning A !Name?

=IIf(IsNull([Forms]![NetCriteria]![Dippedstart]),"All Dates","Report for " & [Forms]![NetCriteria]![Dippedstart] & " to " & [Forms]![NetCriteria]![DippedEnd])

I Tryed To Use The Dippedend To The Same Result

To My Untrained Eye It looks Like Is Should Work
Code It For Both Nz Start And End???
 
Make sure the name of the box on the form is not the same as the name of the field which it represents. If the name of the field is DippedStart or DippedEnd, you should name the box something like DippedStartBox or DippedEndBox. Typically a #NAME error means an incorrectly-typed formula or a circular reference.

Also, use the Expression Builder rather than typing it all out yourself to avoid typos.
 

Users who are viewing this thread

Back
Top Bottom