Parameter Query Criteria Help

  • Thread starter Alastair MacFarlane
  • Start date
A

Alastair MacFarlane

Dear All,

How do I create a parameter query through QBF or in the query grid itself
that takes into account the data type of my field? ie. I have a column that
is a General Date/Time which has both a Date and Time element.

I would like to say show me all the records for yesterday's date (Between
#10/10/2005# And #10/10/2005 23:59:59#). Between Date()-1 and Date() -1 &
"23:59:59" obviously does not work. I could probably work it out over time
through trial and effort but the group would know the answer quicker.

I don't want to format the contents of the field because there can be
200,000 records with this date in it.

Thanks again.
 
V

Van T. Dinh

Use:
= #10/10/2005# AND < #10/11/2005#

(assuming that the format for Short Date in your Regional Settings is
"mm/dd/yyyy".)

--
HTH
Van T. Dinh
MVP (Access)
 
A

Alastair MacFarlane

Van T. Dinh,

Thanks for the quick reply. It's always the obvious answers that are so
irritating!

Alastair
 
V

Van T. Dinh

You're welcome ... Glad to help ...

BTW, you could have used:

Between (Date()-1) And (Date() -1 + #23:59:59#)

but my suggestion is probably a lot clearer ...
 
A

Alastair MacFarlane

Thanks again.

I prefer the non hard coded date -- Between (Date()-1) And (Date() -1 +
#23:59:59#) -- for obvious reasons. Thanks again.

Alastair MacFarlane
 
V

Van T. Dinh

You can use non-hard-coded with >= and < like:
= (Date() - 1) And < Date()

I only use the explicit date values because your example used explicit date
values.
 

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