trouble with query parameters

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

Guest

I have a query that uses parameters (from date) and (to date). This query
works as it should. Then I'm using this query in another query that does not
have any other parameters, but is linked to a table for some other fields.
When I run this query, the parameters from the first query are asked for
twice. I have to enter a from date, a to date, then another from and to
date. Is there a way around this?
 
How about creating a small unbound form where the user can enter the 2
dates, and the query can read them from there?

The Criteria for the query will read:
Between [Forms]![Form1]![from date] And [Forms]![Form1]![to date]

To ensure Access understands them as dates:
1. Declare both parameters in your query, by choosing Parameters on the
Query menu, and entering 2 rows in the dialog:
[Forms]![Form1]![from date] Date/Time
[Forms]![Form1]![to date] Date/Time

2. Set the Format property of both the text boxes on your form to Short
Date.
 
I did think of doing it that way because of the problem. I'm using an
unbound form in another query, so I do know how to do that. But, I have
other queries that have parameters on the first query used in the second
query and they don't request the parameters to be entered twice. I was just
wondering why this is happening.

Thanks, I will use the form, as it seems the only solution in this case.
Just wish I knew why the query is behaving different than the others I am
doing the same way.

Allen Browne said:
How about creating a small unbound form where the user can enter the 2
dates, and the query can read them from there?

The Criteria for the query will read:
Between [Forms]![Form1]![from date] And [Forms]![Form1]![to date]

To ensure Access understands them as dates:
1. Declare both parameters in your query, by choosing Parameters on the
Query menu, and entering 2 rows in the dialog:
[Forms]![Form1]![from date] Date/Time
[Forms]![Form1]![to date] Date/Time

2. Set the Format property of both the text boxes on your form to Short
Date.

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

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

tw said:
I have a query that uses parameters (from date) and (to date). This query
works as it should. Then I'm using this query in another query that does
not
have any other parameters, but is linked to a table for some other fields.
When I run this query, the parameters from the first query are asked for
twice. I have to enter a from date, a to date, then another from and to
date. Is there a way around this?
 
Back
Top