Parameter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form or a report, and when a user opens it, it will prompt the user
to type in a range of dates (eg. Beginning Date and Ending Date). For that,
all I do is I use the formula "Between [Enter Beginning Date] and [Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type in
the range and show the records of the range or leave them blank and show all
the records?

I also would like to do the same thing for the non-range criteria. I think
it should be similar?

Thanks.
 
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
 
Thanks Allen.

Allen Browne said:
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

AccessHelp said:
I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and [Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type in
the range and show the records of the range or leave them blank and show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?

Thanks.
 
Hi Allen,

I tried the steps and codes from your list, and it didn't seem to be
working. When I click on the report, it shows all the records, and the start
and end dates text fields in the Report Header are showing #Name.

Am I missing something?

Thanks.

Allen Browne said:
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

AccessHelp said:
I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and [Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type in
the range and show the records of the range or leave them blank and show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?

Thanks.
 
Try this in the query criteria

Between nz([Enter Beginning Date],#1/01/1900#) And nz([Enter Ending
Date],#1/01/2500#)

It will also let the user enter one date, either start or end date
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



AccessHelp said:
Hi Allen,

I tried the steps and codes from your list, and it didn't seem to be
working. When I click on the report, it shows all the records, and the start
and end dates text fields in the Report Header are showing #Name.

Am I missing something?

Thanks.

Allen Browne said:
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

AccessHelp said:
I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and [Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type in
the range and show the records of the range or leave them blank and show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?

Thanks.
 
Thanks Ofer. It works. Can I do the same way for other criteria too, like
nz([Enter Client Group]," ")?

Thanks.

Ofer said:
Try this in the query criteria

Between nz([Enter Beginning Date],#1/01/1900#) And nz([Enter Ending
Date],#1/01/2500#)

It will also let the user enter one date, either start or end date
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



AccessHelp said:
Hi Allen,

I tried the steps and codes from your list, and it didn't seem to be
working. When I click on the report, it shows all the records, and the start
and end dates text fields in the Report Header are showing #Name.

Am I missing something?

Thanks.

Allen Browne said:
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.


I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and [Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type in
the range and show the records of the range or leave them blank and show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?

Thanks.
 
Yes you can, the NZ will replace the [Parameter] with any other value you
want if its Null
nz([Enter Client Group]," ") that will filter on " "

But if you have that
Where GroupField = [Enter Client Group]
And you want it to display all the records of no parameter was enter, then
use that
Where GroupField Like NZ([Enter Client Group],"*")
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



AccessHelp said:
Thanks Ofer. It works. Can I do the same way for other criteria too, like
nz([Enter Client Group]," ")?

Thanks.

Ofer said:
Try this in the query criteria

Between nz([Enter Beginning Date],#1/01/1900#) And nz([Enter Ending
Date],#1/01/2500#)

It will also let the user enter one date, either start or end date
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



AccessHelp said:
Hi Allen,

I tried the steps and codes from your list, and it didn't seem to be
working. When I click on the report, it shows all the records, and the start
and end dates text fields in the Report Header are showing #Name.

Am I missing something?

Thanks.

:

Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.


I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and [Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type in
the range and show the records of the range or leave them blank and show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?

Thanks.
 
The #Name indicates there is a problem with the way you referred to the text
boxes on the form.

Perhaps you already closed the form?
Or perhaps the form name is spelt wrongly?
Or the text box names are different (e.g. you used a space)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

AccessHelp said:
Hi Allen,

I tried the steps and codes from your list, and it didn't seem to be
working. When I click on the report, it shows all the records, and the
start
and end dates text fields in the Report Header are showing #Name.

Am I missing something?

Thanks.

Allen Browne said:
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the
WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition
based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

AccessHelp said:
I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and
[Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type
in
the range and show the records of the range or leave them blank and
show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?
 
Thanks Allen. I'll try it.

Allen Browne said:
The #Name indicates there is a problem with the way you referred to the text
boxes on the form.

Perhaps you already closed the form?
Or perhaps the form name is spelt wrongly?
Or the text box names are different (e.g. you used a space)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

AccessHelp said:
Hi Allen,

I tried the steps and codes from your list, and it didn't seem to be
working. When I click on the report, it shows all the records, and the
start
and end dates text fields in the Report Header are showing #Name.

Am I missing something?

Thanks.

Allen Browne said:
Instead of using parameters in the query (where the user *has* to enter
something, and the query *has* to interpret the entry), use the
WhereCondion
of the OpenReport action.

Method 2 in this article illustrates how to build the WhereCondition
based
on text boxes on a form:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html


I have a form or a report, and when a user opens it, it will prompt the
user
to type in a range of dates (eg. Beginning Date and Ending Date). For
that,
all I do is I use the formula "Between [Enter Beginning Date] and
[Enter
Ending Date]" in the criteria field.

My question is: What should I do which will allow the user either type
in
the range and show the records of the range or leave them blank and
show
all
the records?

I also would like to do the same thing for the non-range criteria. I
think
it should be similar?
 
Back
Top