Qerying a Flat / related Tables....between dates....

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

Guest

I have a date field.
What is the correct way to query between two dates for different companies,
to return the information form my chosen fields.

At the moment I'm using [Between Date() And Date()]
But not sure if this is the best way.....it returns two parameter boxes one
for Company Name and the other requests the two dates as above.

Can anyone advise me of all my options to achieve this type of query?

Please advise.
Thanks
 
Try using this as the criteria for your date field:

between [start date] and [end date]

When using
[Between Date() And Date()]

Access is interpreting this as a single input parameter.

HTH
 
I would recommend against using parameter prompt queries. You should
consider always using references to values in controls on forms. This method
provides a much better user interface.
 
Thanks Duane
Can yo give me a link to a simple example of what you mean, so I can better
understand thanks
Dermot

Duane Hookom said:
I would recommend against using parameter prompt queries. You should
consider always using references to values in controls on forms. This method
provides a much better user interface.

--
Duane Hookom
MS Access MVP
--

Dermot said:
I have a date field.
What is the correct way to query between two dates for different
companies,
to return the information form my chosen fields.

At the moment I'm using [Between Date() And Date()]
But not sure if this is the best way.....it returns two parameter boxes
one
for Company Name and the other requests the two dates as above.

Can anyone advise me of all my options to achieve this type of query?

Please advise.
Thanks
 
Hi Ed,
Thanks for your reply
Is there an easy way to explain .....to help me reason out the
diferences......why it interpretates it as a single parameter....
Cheers
Dermot

Ed Ardzinski said:
Try using this as the criteria for your date field:

between [start date] and [end date]

When using
[Between Date() And Date()]

Access is interpreting this as a single input parameter.

HTH
 
The square brackets make something a field (if the field exists in a table
in the query) or a table (if the table exists in the query). If the
contents between the brackets is not a field name or table name, then Access
treats the text between the brackets [ ] as a parameter.

Dermot said:
Hi Ed,
Thanks for your reply
Is there an easy way to explain .....to help me reason out the
diferences......why it interpretates it as a single parameter....
Cheers
Dermot

Ed Ardzinski said:
Try using this as the criteria for your date field:

between [start date] and [end date]

When using
[Between Date() And Date()]

Access is interpreting this as a single input parameter.

HTH
 
Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm


A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries
Dermot said:
Thanks Duane
Can yo give me a link to a simple example of what you mean, so I can
better
understand thanks
Dermot

Duane Hookom said:
I would recommend against using parameter prompt queries. You should
consider always using references to values in controls on forms. This
method
provides a much better user interface.

--
Duane Hookom
MS Access MVP
--

Dermot said:
I have a date field.
What is the correct way to query between two dates for different
companies,
to return the information form my chosen fields.

At the moment I'm using [Between Date() And Date()]
But not sure if this is the best way.....it returns two parameter boxes
one
for Company Name and the other requests the two dates as above.

Can anyone advise me of all my options to achieve this type of query?

Please advise.
Thanks
 
Back
Top