473,671 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem to use "between ... and..." in a query

I used "between [StartingDate] and [EndingDate]" in a query as a criteria to
a field called ShipDate.
Very strange, in the case between 1.10.2003 and 31.10.2003, then the records
from 31.10.2003 don't show up. I have to modify it as between 1.10.2003 and
1.11.2003 for the records from 31.10.2003 show up.

anybody had same problem? I check the Access Help but didn't get any clue.

Thanks in advance

Paul
Nov 13 '05 #1
8 14201
Have you tried
=DateFrom and <=DateTwo instead of between? Patrick

On Fri, 15 Oct 2004 17:33:37 GMT, "Paul T. Rong" <et***@hotmail. com>
wrote:
I used "between [StartingDate] and [EndingDate]" in a query as a criteria to
a field called ShipDate.
Very strange, in the case between 1.10.2003 and 31.10.2003, then the records
from 31.10.2003 don't show up. I have to modify it as between 1.10.2003 and
1.11.2003 for the records from 31.10.2003 show up.

anybody had same problem? I check the Access Help but didn't get any clue.

Thanks in advance

Paul


Nov 13 '05 #2
Paul T. Rong wrote:
I used "between [StartingDate] and [EndingDate]" in a query as a criteria to
a field called ShipDate.
Very strange, in the case between 1.10.2003 and 31.10.2003, then the records
from 31.10.2003 don't show up. I have to modify it as between 1.10.2003 and
1.11.2003 for the records from 31.10.2003 show up.

anybody had same problem? I check the Access Help but didn't get any clue.

Thanks in advance

Paul


If you assign a value of Date() to a field, the time is 00:00:00

If you assign a value of Now() to a field, the time is whatever time it
was when saved.

So...if you attempt to select records in 10/31/2004, and you are asking
for 00:00:00 then a record of 10/31/2004 00:00:01 will not be selected.

That is why you need to add another day...because you are then selecting
records less than 11/01/2004 00:00:00.
Nov 13 '05 #3
On Fri, 15 Oct 2004 17:33:37 GMT, Paul T. Rong wrote:
I used "between [StartingDate] and [EndingDate]" in a query as a criteria to
a field called ShipDate.
Very strange, in the case between 1.10.2003 and 31.10.2003, then the records
from 31.10.2003 don't show up. I have to modify it as between 1.10.2003 and
1.11.2003 for the records from 31.10.2003 show up.

anybody had same problem? I check the Access Help but didn't get any clue.

Thanks in advance

Paul


If, in using Between [Start Date] and [End Date] , you don't get the
final day, it is probably because your date field is storing a time
value as well as a date value.

Entering #07/08/2004# as an [End Date] will return records up to
Midnight of that date, and so no records appear to be returned (unless
you do actually have a date and time value of exactly midnight.

Either update your table to remove the time value,
or manually enter one day later to the wanted period,
or use:

Between [Start Date] and ([End Date]+1)

In which case you must enter the [Start Date] and [End Date] as
Date/Time parameters in the Query Parameter dialog box:
In Query Design View, click Query + Parameter

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4
Thanks to Patrick, Salad, and fredg. I understand the problem now and think
what fredg said --- to use [End Date]+1 --- should be a very good solution.

Paul

"fredg" <fg******@examp le.invalid>
??????:os****** *************** *******@40tude. net...
On Fri, 15 Oct 2004 17:33:37 GMT, Paul T. Rong wrote:
I used "between [StartingDate] and [EndingDate]" in a query as a criteria to a field called ShipDate.
Very strange, in the case between 1.10.2003 and 31.10.2003, then the records from 31.10.2003 don't show up. I have to modify it as between 1.10.2003 and 1.11.2003 for the records from 31.10.2003 show up.

anybody had same problem? I check the Access Help but didn't get any clue.
Thanks in advance

Paul


If, in using Between [Start Date] and [End Date] , you don't get the
final day, it is probably because your date field is storing a time
value as well as a date value.

Entering #07/08/2004# as an [End Date] will return records up to
Midnight of that date, and so no records appear to be returned (unless
you do actually have a date and time value of exactly midnight.

Either update your table to remove the time value,
or manually enter one day later to the wanted period,
or use:

Between [Start Date] and ([End Date]+1)

In which case you must enter the [Start Date] and [End Date] as
Date/Time parameters in the Query Parameter dialog box:
In Query Design View, click Query + Parameter

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #5
"Paul T. Rong" <et***@hotmail. com> wrote in message
news:PR******** ***********@new s.chello.at...
Thanks to Patrick, Salad, and fredg. I understand the problem now and
think
what fredg said --- to use [End Date]+1 --- should be a very good
solution.

Paul


But it's not the correct one.
If you have [End Date] set in your table as Date/Time
" ... WHERE (((Table1.[End Date]) Between #10/1/2003# And #10/31/2003#));"
must work.

Bruno

Nov 13 '05 #6
"Bruno Campanini" <br************ *@tin.it> wrote in message
news:Lf******** ************@ne ws3.tin.it...
"Paul T. Rong" <et***@hotmail. com> wrote in message
news:PR******** ***********@new s.chello.at...
Thanks to Patrick, Salad, and fredg. I understand the problem now and
think
what fredg said --- to use [End Date]+1 --- should be a very good
solution.

Paul


But it's not the correct one.
If you have [End Date] set in your table as Date/Time
" ... WHERE (((Table1.[End Date]) Between #10/1/2003# And #10/31/2003#));"
must work.


Reread what Salad posted, Bruno. If End Date includes a time, using an end
date of 10/31/2003 will not retrieve any records for the 31st unless they
happened to be exactly at midnight.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
Nov 13 '05 #7
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:gO******** ************@ro gers.com...
"Bruno Campanini" <br************ *@tin.it> wrote in message
news:Lf******** ************@ne ws3.tin.it...
"Paul T. Rong" <et***@hotmail. com> wrote in message
news:PR******** ***********@new s.chello.at...
> Thanks to Patrick, Salad, and fredg. I understand the problem now and
> think
> what fredg said --- to use [End Date]+1 --- should be a very good
> solution.
>
> Paul


But it's not the correct one.
If you have [End Date] set in your table as Date/Time
" ... WHERE (((Table1.[End Date]) Between #10/1/2003# And
#10/31/2003#));"
must work.


Reread what Salad posted, Bruno. If End Date includes a time, using an end
date of 10/31/2003 will not retrieve any records for the 31st unless they
happened to be exactly at midnight.


Ok, well understood now.
Thanks
Bruno
Nov 13 '05 #8
That was very useful to me too
Patrick

On Sat, 16 Oct 2004 14:53:22 GMT, "Bruno Campanini"
<br************ *@tin.it> wrote:
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:gO******* *************@r ogers.com...
"Bruno Campanini" <br************ *@tin.it> wrote in message
news:Lf******** ************@ne ws3.tin.it...
"Paul T. Rong" <et***@hotmail. com> wrote in message
news:PR******** ***********@new s.chello.at...
> Thanks to Patrick, Salad, and fredg. I understand the problem now and
> think
> what fredg said --- to use [End Date]+1 --- should be a very good
> solution.
>
> Paul

But it's not the correct one.
If you have [End Date] set in your table as Date/Time
" ... WHERE (((Table1.[End Date]) Between #10/1/2003# And
#10/31/2003#));"
must work.


Reread what Salad posted, Bruno. If End Date includes a time, using an end
date of 10/31/2003 will not retrieve any records for the 31st unless they
happened to be exactly at midnight.


Ok, well understood now.
Thanks
Bruno


Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2027
by: Kevin | last post by:
When I run the query (please see below) between 08:30:00 and 17:29:59, I get the data from row 1; if I run the same query between 17:30:00 and 08:29:59, I get the "empty set." Can anyone explain why? Many thanks! Table SQL:
3
42057
by: karthik | last post by:
Does anybody know what is the limit for the number of values one can have in a list of expressions (to test for a match) for the IN clause? For example, SELECT au_lname, state FROM authors WHERE state IN ('CA', 'IN', 'MD') Is there a limit in the number of expressions that can be included in the list to check for a match to STATE? I know this is a bad example as
16
9312
by: Bernd Hohmann | last post by:
Hi there, we're currently convert an old ISAM application to Java and DB2. Among the load of problems we found the reports which have user selections like "select all data between mm/yyyy and mm/yyyy". Means: if the user enters "10/2004 - 10/2005" everything between "2004-10-01" and "2004-10-31" is selected.
4
3334
by: Greg Iocco | last post by:
Simple problem, but I've checked the newsgroups and couldn't find an answer. On the main swithboard is a command button to open a report. The report I built is based off a query, and the query is now restricted by the simple "Between And ". What I want to do is pass the values of the two parameters into some textboxes in the heading of the report (so if 12/1/03 and 12/31/03 are the parameters, I can display the entered dates in the...
1
4652
by: Jaycee66 | last post by:
Access 2000 "Between" query question: I am relatively new to MS Access and everytime I think I have a basic concept of the program it pokes me in the eye with something I think would be simple to create. I want to create 2 separate queries for a label. I would like to have the query prompt me for the date I choose to start from until the present date and the other to prompt me for the date I choose to start from and 2 additional numbers...
3
2101
by: Jim | last post by:
I'm having a problem with a date query..im trying to pull customer data based on a date specified from a form to 3 months prior to the date specified. So lets say in the form I specified 1/2/2004. I would need all records with a date in October '03, November '03, December '03 and January '04. Every thing ive tried hasnt worked and im getting all types of weird recordsets.. thanks -Jim
11
2078
by: MLH | last post by:
I have a query field... Description: & "2-tone" When I run it, the output in that field is empty. If I change the name to MyDescription - it works fine. I noticed the query field has a Description property setting. That's what's causing my problem. Just a 'heads-up' to the group letting you know to watch out for it. It took me a long time to recognize the error. I have another
4
3642
by: mukesh | last post by:
One another problem I have used a formula in the calculated field of a query as - IIf( <=, (IIf(<=, , ), (IIf (<=, , )) the above formula is working properly to give the lowest of , and but the problem is that the query is some slow as compared to other query not having such formula. At present, there is only one record in the query to calculate and to show. I fear if what will happen if there will be lots of records. what to do
92
3931
by: ureuffyrtu955 | last post by:
Python is a good programming language, but "Python" is not a good name. First, python also means snake, Monty Python. If we search "python" in google, emule, many results are not programming resource. If we search PHP, all results are programming resource. Second, python also means snake, snake is not a good thing in western culture. Many people dislike any things relevant to snake. We must have high regard for the custom.
15
3174
by: =?ISO-8859-15?Q?L=E9na=EFc?= Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all, For some reasons, somewhere in a program, I'd like, if possible, to quickly parse a whole file before rewinding it and letting the full analysis start. My problem is that the FILE* I want do parse has been fopen'ed far away from where I am and I don't know in which MODE my FILE* has been opened. And additionally, my FILE* may not be a regular file, but a continuous
0
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8927
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6237
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.