dbTalk Databases Forums  

Inputting a date in a query

comp.database.ms-access comp.database.ms-access


Discuss Inputting a date in a query in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chad Krogh
 
Posts: n/a

Default Inputting a date in a query - 02-13-2004 , 07:58 PM






I have a db with a date, and want to select all records between two
different dates Right now I can set criteria in the query to something like
Quote:
=#1/1/2003# And <#7/1/2003# and the records are selected, but the process
is error prone.

What I would like to do is have Access ask the user for a beginning and
ending dates and then do the query. This has to be easy, but I'm stumped.
Any ideas?

Thanks

--
Chad Krogh
canutek (AT) cox (DOT) net




Reply With Quote
  #2  
Old   
Ira Solomon
 
Posts: n/a

Default Re: Inputting a date in a query - 02-14-2004 , 03:09 PM






Chad:
There are 2 ways to do this.

I just going to give you one. You don't have to use the names I use.

Create a form called Gdates.
2 text boxes and a command button
text boxes are named bdate and edate.
You can have any text you want for instructions.
The command button executes the query .

In the query the criterion would be:

Between forms!gdates!bdate and forms!gdates!edate


Note that the form must be open to execute the query.

You can augment this method by using a hidden form. If you get this
to work look up hidden forms.

Good luck
Ira Solomon



On Fri, 13 Feb 2004 17:58:34 -0800, "Chad Krogh" <canutek (AT) cox (DOT) net>
wrote:

Quote:
I have a db with a date, and want to select all records between two
different dates Right now I can set criteria in the query to something like
=#1/1/2003# And <#7/1/2003# and the records are selected, but the process
is error prone.

What I would like to do is have Access ask the user for a beginning and
ending dates and then do the query. This has to be easy, but I'm stumped.
Any ideas?

Thanks


Reply With Quote
  #3  
Old   
Bruce Pick
 
Posts: n/a

Default Re: Inputting a date in a query - 02-19-2004 , 09:21 PM



You can do what you described right in the query itself.

Put this in the criteria box for the field containing the date:
Quote:
=[Enter Start Date] And <=[Enter End Date]
I have this in use now in an Access 2000 database.

Access also has an expression:
Between xxx AND xxx
which works with dates, but apparently does not work if
you try to use it this way, as a Parameter Query.
You can hard-code it into the query criteria, as
Between #5/31/03# AND #6/5/02#

Bruce Pick
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
To send email, remove all < > and [ ] and the junk ~ between:
[brucepick1]
< a~t >
[comcast.net]


Chad Krogh wrote:
Quote:
I have a db with a date, and want to select all records between two
different dates Right now I can set criteria in the query to something like

=#1/1/2003# And <#7/1/2003# and the records are selected, but the process

is error prone.

What I would like to do is have Access ask the user for a beginning and
ending dates and then do the query. This has to be easy, but I'm stumped.
Any ideas?

Thanks


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.