Seearch criteria in a question to be presented in a report

L

Leif Thorsen

I have a query based om a table with a bunch of posts sorted by the field
"Date". The query is based on the criteria "Between Date1 and Date2" in the
field "Date". I want to show Date1 and Date2 in the header in a report based
on the question above even if there are no posts with just these dates in the
field "Dare".
How to do ??
 
J

John W. Vinson

I have a query based om a table with a bunch of posts sorted by the field
"Date". The query is based on the criteria "Between Date1 and Date2" in the
field "Date". I want to show Date1 and Date2 in the header in a report based
on the question above even if there are no posts with just these dates in the
field "Dare".
How to do ??

One thing I'd suggest is changing the name of the field Date. It's a reserved
word (for the builtin Date() function) and can and will cause trouble.

If you are using a parameter query with criteria like

Between [Date1] AND [Date2]

then you can use a textbox on the report with a control source

=[Date1]

You'll be better off using a form to provide the criteria: say the form is
named frmCrit, with textboxes txtStartdate and txtEnddate. You can then use
= [Forms]![frmCrit]![txtStartDate] AND < DateAdd("d", 1, [Forms]![frmCrit]![txtEndDate])

to catch date/time values with a time component on the last day; you can then
use a textbox with a control source

=[Forms]![frmCrit]![txtStartDate]

and the same for the end date.
 
L

Leif Thorsen

--
Thanks in advance for Your help


John W. Vinson said:
I have a query based om a table with a bunch of posts sorted by the field
"Date". The query is based on the criteria "Between Date1 and Date2" in the
field "Date". I want to show Date1 and Date2 in the header in a report based
on the question above even if there are no posts with just these dates in the
field "Dare".
How to do ??

One thing I'd suggest is changing the name of the field Date. It's a reserved
word (for the builtin Date() function) and can and will cause trouble.

If you are using a parameter query with criteria like

Between [Date1] AND [Date2]

then you can use a textbox on the report with a control source

=[Date1]

You'll be better off using a form to provide the criteria: say the form is
named frmCrit, with textboxes txtStartdate and txtEnddate. You can then use
= [Forms]![frmCrit]![txtStartDate] AND < DateAdd("d", 1, [Forms]![frmCrit]![txtEndDate])

to catch date/time values with a time component on the last day; you can then
use a textbox with a control source

=[Forms]![frmCrit]![txtStartDate]

and the same for the end date.
.Thank You for Your solution but if I don´t want to use a separate form for this ??
The reason for this is that the command for the report is given from a
start-upform and I want to have the report directly from this start-upform.
Do You have a solution for this ???
 
J

John W. Vinson

The reason for this is that the command for the report is given from a
start-upform and I want to have the report directly from this start-upform.
Do You have a solution for this ???

A couple; one would be to put textboxes on the startup form and reference
them. If you don't want the textboxes cluttering the form, an alternative
would be to have a small unbound form. You can put code in the Report's Open
event to open the form in Dialog view; the "open" event fires before the
recordsource of the report is populated, so the form will open and allow the
user to enter the dates. Put a button on the form to set the form's Visible
property to No; this will let the report's code resume, opening the report.

Put code in the Report's Close event to close the form.
 
D

De Jager

Leif Thorsen said:
I have a query based om a table with a bunch of posts sorted by the field
"Date". The query is based on the criteria "Between Date1 and Date2" in
the
field "Date". I want to show Date1 and Date2 in the header in a report
based
on the question above even if there are no posts with just these dates in
the
field "Dare".
How to do ??
 
J

joelgeraldine

jkjkjkj

"Leif Thorsen" <[email protected]> a écrit dans le
message de groupe de discussion :
(e-mail address removed)...
--
Thanks in advance for Your help


John W. Vinson said:
I have a query based om a table with a bunch of posts sorted by the
field
"Date". The query is based on the criteria "Between Date1 and Date2" in
the
field "Date". I want to show Date1 and Date2 in the header in a report
based
on the question above even if there are no posts with just these dates
in the
field "Dare".
How to do ??

One thing I'd suggest is changing the name of the field Date. It's a
reserved
word (for the builtin Date() function) and can and will cause trouble.

If you are using a parameter query with criteria like

Between [Date1] AND [Date2]

then you can use a textbox on the report with a control source

=[Date1]

You'll be better off using a form to provide the criteria: say the form
is
named frmCrit, with textboxes txtStartdate and txtEnddate. You can then
use
= [Forms]![frmCrit]![txtStartDate] AND < DateAdd("d", 1,
[Forms]![frmCrit]![txtEndDate])

to catch date/time values with a time component on the last day; you can
then
use a textbox with a control source

=[Forms]![frmCrit]![txtStartDate]

and the same for the end date.
.Thank You for Your solution but if I don´t want to use a separate form
for this ??
The reason for this is that the command for the report is given from a
start-upform and I want to have the report directly from this
start-upform.
Do You have a solution for this ???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top