DMax doesn't like a parameter query. I suggest the following (which I
tested and it does work):
Create an unbound form to gather the start date and end date and open your
report.
I called the form frmReportParam and the two textboxes are named txtStart
and txtEnd. There is a command button on this form which opens your
report...
DoCmd.OpenReport "Name of Report", acPreview
Set the format of txtStart and txtEnd to Short Date.
Open your query and change your [Start date:] parameter to
Forms!frmReportParam!txtStart
Change the [End date:] parameter to
Forms!frmReportParam!txtEnd
The report would still have a textbox with
=DMax("dated", "4 loading ytd")
as the control source.
To run, open the form and enter your two dates and click on the command
button.
--
Joan Wild
Microsoft Access MVP
Arlene said:
I have tried this =dmax("dated","4 loading ytd") and I get an error. My
date
field is called dated and it has a parameter query in it between([Start
date:])and([End date:]) the problem with the end date is anyone requesting
the form does not know when the information has been updated to so they
will
be using a future date. I want the report to show what the actual date of
the information is valid to. What can I be doing wrong. Thanks
Joan Wild said:
The DMax function should do it.
DMax("DateField","name of query")
--
Joan Wild
Microsoft Access MVP
Sorry Joan new I wasn't clear enough. No I want the report to print
the
last date on the information that comes in. I may put 31/03/07 but the
information is only up to 28/03/07 which is what I want to print. The
other
I can do. Thanks
:
If I understand you correctly, you have a report based on a query.
You
enter a date range
01/03/07 to 31/03/07 and the query correctly pulls information between
those
two dates.
(There may actually be only data to 28/03/07). You'd like your report
to
print the criteria you actually entered.
If that's correct just put a textbox on the report and set its control
source to
="For the period " & [start date] & " to " & [end date]
It is *very* important that you specify the criteria (what's between
the
square brackets) in exactly the same way as you did in the query.
Upon proofing this, you'll see that I didn't use the exact same
criteria
(I
missed the colons), so to fix...
="For the period " & [start date:] & " to " & [end date:]
--
Joan Wild
Microsoft Access MVP
I have a report that is based on a query with a date parameter
between[start
date:]and[end date:], this all works fine but I would like my report
to
show
the end date that is actually showing on the report. The input
could
be
01/03/07 to 31/03/07 but there is only information to 28/03/07. I
have
tried
=max([datefield]) and get an error message. Checked the forum and
tried
=dmax("[datefield]","query name") but it does not like the comma.
Maybe
because of my between and parameter. Anyway I want the date from
the
report
not from the query input, as they could be different. Hope I
explained
well
enough. Thanks