Parameterized query

  • Thread starter Duncan via AccessMonster.com
  • Start date
D

Duncan via AccessMonster.com

Hi,

I have a parameterized query which takes date as an input and gives me the
results of the query.

What I would like to do is multitask this query in such a way that in case I
do not provide any input for a period of 10 seconds (let's assume), then it
automatically gives me the data for the previous day.

Is this possible?

Thank you in advance.
 
A

Allen Browne

Parameters are a horrid user interface. You will need to use a form to
achieve what you describe.

The nearest you could get would be to substitute yesterday's date if the
user did not enter a value:

1. In query design, enter an expression like this into the Criteria row
under your date field:
IIf([What Date] Is Null, Date() - 1, [What Date])

2. To ensure Acess interprets the value correctly, declare the parameter by
choosing Parameters on the Query menu. Access opens a dialog. Enter the same
parameter name, and specify the data type, i.e.:
[What Date] Date
 
D

Duncan via AccessMonster.com

Thank you for your help, Allen. Really appreciate it.


Allen said:
Parameters are a horrid user interface. You will need to use a form to
achieve what you describe.

The nearest you could get would be to substitute yesterday's date if the
user did not enter a value:

1. In query design, enter an expression like this into the Criteria row
under your date field:
IIf([What Date] Is Null, Date() - 1, [What Date])

2. To ensure Acess interprets the value correctly, declare the parameter by
choosing Parameters on the Query menu. Access opens a dialog. Enter the same
parameter name, and specify the data type, i.e.:
[What Date] Date
I have a parameterized query which takes date as an input and gives me
the results of the query.
[quoted text clipped - 4 lines]
it
automatically gives me the data for the previous day.
 

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