Parameter Query - one criteria, multiple fields

T

Tia

I have a query that has two date fields, a period recieved field and a period
paid field. I want to be able to prompt the user once to enter in a date.
That one date will set the criteria for both the period received and the
period paid fields. How can this be done? I don't want the user to be
prompted twice.
 
D

Douglas J. Steele

Use the exact same criteria for both fields. I find it's a good idea to
copy-and-paste, rather than retype, just to make sure you don't accidentally
introduce a typo.
 
T

Tia

I'm not sure I understand what you mean. I am creating a parameter query
that other users will use. When the user runs the query, it will prompt the
user by asking to enter an Accrual Date. This date needs to be used for the
criteria in the Period Received field and the Period Paid field.
The criteria in the Period Received field is: <= [Enter the Accrual Date]
The criteria in the Period Paid field is: is null or >= [Enter the Accrual
Date]

My question is how can I get the query to prompt the user only once for the
Accrual Date and have that date populate both fields' criteria?
 
D

Douglas J. Steele

As long as you have EXACTLY the same [Enter the Accrual Date] in both
locations, you should only be prompted once.

If you're being prompted more than once, check exactly what text is in the
prompt. It's possible that something else is causing the second prompt.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Tia said:
I'm not sure I understand what you mean. I am creating a parameter query
that other users will use. When the user runs the query, it will prompt
the
user by asking to enter an Accrual Date. This date needs to be used for
the
criteria in the Period Received field and the Period Paid field.
The criteria in the Period Received field is: <= [Enter the Accrual Date]
The criteria in the Period Paid field is: is null or >= [Enter the
Accrual
Date]

My question is how can I get the query to prompt the user only once for
the
Accrual Date and have that date populate both fields' criteria?

Douglas J. Steele said:
Use the exact same criteria for both fields. I find it's a good idea to
copy-and-paste, rather than retype, just to make sure you don't
accidentally
introduce a typo.
 
V

V

I have a query that has two date fields, a period recieved field and a period
paid field. I want to be able to prompt the user once to enter in a date.
That one date will set the criteria for both the period received and the
period paid fields. How can this be done? I don't want the user to be
prompted twice.

I was trying to do this too and he's right you do need the same
criteria but if you leave it like that it will only pull up the
records where the date entered is in both fields. If you are looking
for it to pull up records where the date is in either field you have
to change the And statement to Or.

In design view enter the same criteria in both fields so [Enter
Date].
Switch to SQL view, there will be a string that says:
WHERE (((TableName.FieldName)=[Enter Project Code]) And ((TableName.
[2ndFieldName])=[Enter Project Code])

Change the And to Or and it will search both date fields and bring up
records that have that Date in EITHER field.
 

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