Something else is applying a filter to yoru report.
Open the report in design view, clear anything in its Filter property,
and
set the Filter On Load property to No.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
message
Hi Allen
Yes. If I open the report directly from the reports section of the
database
window and key in the same date range in the date dialog boxes that
pop-up
(drivenby the criterea in the underlying query) - I get the desired
result.
I launch the report from a button on the form that has the txtStart and
txtStop text boxes. It just runs the standard generated command button
vb
script:-
Dim stDocName As String
stDocName = "rptVariationbyDate"
DoCmd.OpenReport stDocName, acPreview
The report pops up over the top of the form, so my understanding is
that
it
should still have reference to the contols on that form until such a
time
that the form is destroyed.
:
Okay, the problem is with the expression you are passing to the
filter.
Presumably when you run the query directly, you are getting the
desired
records.
How are you opening the report? Is there an expression that Access is
evaluating to 0 (i.e. False for all records)?
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
message
Hi Allen
In the intermediate window I get:-
?Reports![rptVariationbyDate].Filter
0
I know the values are getting to the report because I have two
unbound
text
boxes on the report that are reporting the values from the forms
fields
correctly.
:
When the report opens with no records, ask Access how it is being
filtered.
Assuming a report name of Report1, open the Immediate Window
(Ctrl+G),
and
enter:
? Reports![Report1].Filter
Post a reply showing what comes out.
in
message
Hi Allen
Thanks for your prompt response.
That didn't make any difference sorry.
Yes the field is of date/time and it's format is set to short
date
in
every
reference (the underlying table, the query the report is based
off,
the
form
that drives the report and the report itself).
Any further ideas?
:
Declare the parameters in the query.
In query design view, choose Parameters on the Query menu.
In the dialog, enter 2 rows:
[Forms]![frmReports]![txtStart] Date/Time
[Forms]![frmReports]![txtEnd] Date/Time
We are assuming here that you have this criterion under a
date/time
field.
If it's a Text field in your table, or a calculated field in the
query,
it
may need further help.
"Neill M. Pinkney" <
[email protected]>
wrote
in
message
Access 2003 on Windows XP Pro
I have a date field in a query, with the crriteria:-
Between [Forms]![frmReports]!txtStart and
[Forms]![frmReports]!txtEnd
I have a form (frmReports) with two text fields txtStart and
txtEnd
and
a
button to open a report whose data is based on the above
query.
The report will not bring up any results.
If I open the form & run the query I see results. If I put two
unbound
text
boxes on the report to show txtStart & txtStop the values show
the
correct
data.
I have tried making all references to the date (in the table,
in
the
query
on the form) all short date.