A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

parameter date question



 
 
Thread Tools Display Modes
  #1  
Old January 17th, 2009, 07:45 PM posted to microsoft.public.access.gettingstarted
steve goodrich
external usenet poster
 
Posts: 132
Default parameter date question

I am trying to create a parameter query on a date field.

The date is a time stamp - The property has been set to =now() on the table
the query is bound to.

I am trying to list a date range using the criteria below



Between [Please Enter Start Date] And [Please Enter End Date]



This lists the first date and the next to last date but will not show the
last date

e.g. typing 1 Dec 08 to 31 Dec 08 will show 1 Dec 08 to 30 Dec 08 (the last
day is missing)



The above criteria works ok on date fields that have not had their property
set to =now()



I have been told that Access treats every date as a number and if I enter
the time as well as the date it will work

Typing:1 Dec 08 to Dec 31 08 23:59:59 does in fact work.



My question:

Is there a way that I can add something to the criteria in my query so the
user just has to enter both dates and not worry about the time



Something like



Between [Please Enter Start Date] And [Please Enter End Date]+23:59:59



Thanks for any advice



Steve Goodrich


  #2  
Old January 17th, 2009, 07:56 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default parameter date question

On Sat, 17 Jan 2009 19:45:56 +0000, Steve Goodrich wrote:
I am trying to list a date range using the criteria below

Between [Please Enter Start Date] And [Please Enter End Date]

This lists the first date and the next to last date but will not show
the last date

Typing:1 Dec 08 to Dec 31 08 23:59:59 does in fact work.

Is there a way that I can add something to the criteria in my query so
the user just has to enter both dates and not worry about the time
Something like

Between [Please Enter Start Date] And [Please Enter End Date]+23:59:59


You basically have it. What I do is not use BETWEEN, but instead use =
on the start date and on the last date, but I add a day to the value
the user enters.

WHERE FieldName = [Please Enter Start Date]
AND FieldName DateAdd("d", 1, [Please Enter End Date])



--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
  #3  
Old January 17th, 2009, 08:16 PM posted to microsoft.public.access.gettingstarted
steve goodrich
external usenet poster
 
Posts: 132
Default parameter date question

Thanks Rick, Worked perfectly

Regards

Steve
"Rick Brandt" wrote in message
...
On Sat, 17 Jan 2009 19:45:56 +0000, Steve Goodrich wrote:
I am trying to list a date range using the criteria below

Between [Please Enter Start Date] And [Please Enter End Date]

This lists the first date and the next to last date but will not show
the last date

Typing:1 Dec 08 to Dec 31 08 23:59:59 does in fact work.

Is there a way that I can add something to the criteria in my query so
the user just has to enter both dates and not worry about the time
Something like

Between [Please Enter Start Date] And [Please Enter End Date]+23:59:59


You basically have it. What I do is not use BETWEEN, but instead use =
on the start date and on the last date, but I add a day to the value
the user enters.

WHERE FieldName = [Please Enter Start Date]
AND FieldName DateAdd("d", 1, [Please Enter End Date])



--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



  #4  
Old January 17th, 2009, 08:33 PM posted to microsoft.public.access.gettingstarted
Tom Lake[_2_]
external usenet poster
 
Posts: 96
Default parameter date question


"Steve Goodrich" wrote in message
.. .
I am trying to create a parameter query on a date field.

The date is a time stamp - The property has been set to =now() on the
table the query is bound to.

I am trying to list a date range using the criteria below



Between [Please Enter Start Date] And [Please Enter End Date]



This lists the first date and the next to last date but will not show the
last date


If you don't need the time for any reason, don't use Now(), use Date()
Then your BETWEEN will work OK.

Tom Lake

 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.