473,763 Members | 5,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

date range

Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks
--
Andrew

Jul 19 '05 #1
12 1767
Andrew wrote:
Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks

Jet requires you to use # to delimit literal dates. You should use ISO date
format, like this:

where date >=#2004-03-01# and date <=#2004-03-31#
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
But Access datetime format only has 3/31/2004, how can I make it work?
Thanks

--
Andrew
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Andrew wrote:
Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks

Jet requires you to use # to delimit literal dates. You should use ISO

date format, like this:

where date >=#2004-03-01# and date <=#2004-03-31#
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #3
What I am going to do is to select the month or year from the date, for
example,
select * from table where thedate >=#2004-[var]-01# and thedate
<=#2004-[var]-31#
That means all the record in a month. Can you help? Thanks.

--
Andrew
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Andrew wrote:
Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks

Jet requires you to use # to delimit literal dates. You should use ISO

date format, like this:

where date >=#2004-03-01# and date <=#2004-03-31#
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #4
You are wrong. The ISO format I suggested will work fine. I have used it
myself.

Your error is in thinking that the database stores the dates in a particular
format. This is not true. If you read the online help, you will see that
Access stores date/time data as numbers of type Double. The whole number
portion represents the number of days since the seed date. The decimal
portion represents the time of day (.0 = midnight, .5 = noon)

Bob Barrows
Andrew wrote:
But Access datetime format only has 3/31/2004, how can I make it work?
Thanks
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Andrew wrote:
Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks

Jet requires you to use # to delimit literal dates. You should use
ISO date format, like this:

where date >=#2004-03-01# and date <=#2004-03-31#

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5
Andrew wrote on 29 mrt 2004 in microsoft.publi c.inetserver.as p.general:
What I am going to do is to select the month or year from the date, for
example,
select * from table where thedate >=#2004-[var]-01# and thedate
<=#2004-[var]-31#
That means all the record in a month. Can you help? Thanks.


What about February, or April for that matter?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #6
That makes no sense. What you should do is pass a start and end date to the
query, like this:

select <list of fields> from table
where thedate >= [pStart] and theDate <=[pEnd]

When you test this in Access, you will get prompted for the two dates. Save
the query as qRecordsInDateR ange. In ASP, call it by:

dim rs, cn
set cn=server.creat eobject("adodb. connection")
cn.open "<valid connection string>"
set rs=server.creat eobject("adodb. recordset")
cn.qRecordsInDa teRange "2004-03-01#,#2004-03-31#,rs

HTH,
Bob Barrows
Andrew wrote:
What I am going to do is to select the month or year from the date,
for example,
select * from table where thedate >=#2004-[var]-01# and thedate
<=#2004-[var]-31#
That means all the record in a month. Can you help? Thanks.
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Andrew wrote:
Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks

Jet requires you to use # to delimit literal dates. You should use
ISO date format, like this:

where date >=#2004-03-01# and date <=#2004-03-31#
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #7
Bob Barrows [MVP] wrote on 29 mrt 2004 in
microsoft.publi c.inetserver.as p.general:
That makes no sense. What you should do is pass a start and end date
to the query, like this:

select <list of fields> from table
where thedate >= [pStart] and theDate <=[pEnd]


What about the "between" keyword ?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #8
Evertjan. wrote:
Bob Barrows [MVP] wrote on 29 mrt 2004 in
microsoft.publi c.inetserver.as p.general:
That makes no sense. What you should do is pass a start and end date
to the query, like this:

select <list of fields> from table
where thedate >= [pStart] and theDate <=[pEnd]


What about the "between" keyword ?

Either way.
Aaron has lobbied against the use of "between", and while I personally have
no problem with it, other users might. Since the OP started off using this
method, I saw no reason to suggest otherwise.

One thing I neglected to suggest to the OP: if users are entering times as
well as dates into thedate, then the above query should be changed to:

select <list of fields> from table
where thedate >= [pStart] and theDate <dateadd("d", 1,[pEnd])

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #9
How can I select the records containing March(or 03) in theDate, for
example, 03/21/2004, 03/12/1996. Can I do that? Thanks anyway.

--
Andrew
"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:O1******** ******@TK2MSFTN GP12.phx.gbl...
Evertjan. wrote:
Bob Barrows [MVP] wrote on 29 mrt 2004 in
microsoft.publi c.inetserver.as p.general:
That makes no sense. What you should do is pass a start and end date
to the query, like this:

select <list of fields> from table
where thedate >= [pStart] and theDate <=[pEnd]

What about the "between" keyword ?

Either way.
Aaron has lobbied against the use of "between", and while I personally

have no problem with it, other users might. Since the OP started off using this
method, I saw no reason to suggest otherwise.

One thing I neglected to suggest to the OP: if users are entering times as
well as dates into thedate, then the above query should be changed to:

select <list of fields> from table
where thedate >= [pStart] and theDate <dateadd("d", 1,[pEnd])

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #10

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

Similar topics

2
5219
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much appreciated. TIA
8
2672
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them to select today. example: var dtToday = Date() if(document.frmSoftware.txtDDate.value == dtToday) {
5
14896
by: BlackFireNova | last post by:
I need to write a report in which one part shows a count of how many total records fall within the working days (Monday - Friday) inside of a (prompted) given date range, in a particular geographical region. I have written a query which prompts the user for the start and end dates. It also filters for entries which pertain to the particular geographical region. I'm not sure where to go from here.
12
6392
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date ranges, ie between 24/09/2004 and 01/10/2004 together with 05/10/2004 and 07/10/2004 ? If I enter the "Between" criteria on different lines it returns no data.
3
7466
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The report prints dental and hygenist appointments for the date (one subreport for each). The user wants to enter a date range and have one page for each date in the date range. I'm wondering how to modify the report. The only way I see is to create...
6
3234
by: alexanderpope11 | last post by:
Hello, how do I write this SQL: I would like to check the Main table for invalid rows. An invalid row is: any row where the Start_date to stop_date range overlaps an invalid date in the Code table. For example, Row#2 is invalid because the Start_date-Stop_Date range overlaps 2 days in the code table where the code AA was not valid (12/30/2000 - 12/31/2000) Main Table
18
38246
by: dfetrow410 | last post by:
Anyone have some code that will do this? Dave
19
3929
by: ali3n8 | last post by:
Hello I have attempted to create a date range report from a query called qrycustomerinformation. The field that contains the value of my date is called Followup. When i run a report on this it is fine. But I have decided I would like to pull this report for a specific date range. Ive attempted to use the method on allen brownes page http://allenbrowne.com/casu-08.html. I would like to also mention the followup field also uses this code to...
4
2853
Sandboxer
by: Sandboxer | last post by:
I want to be able to program Access to provide for me, by individual day, what my contract obligations are to my customers. Will Access recognize all the individual days in between a date range (simply a "from" date and a "to" date)? Additionally, I need to delivery a specific quantity of product when the customer's inventory is within about parameter levels. EXAMPLE: "During the Date Range January 1, 2010 through April 30, 2010 when...
2
1707
by: grego9 | last post by:
I have a problem in Excel 2000. I have written some VBA code that transfers data from the current excel workbook to a file called "Deal Input2.xls". Everything transfers ok apart from the date in cell ("G28"). This gets converted into an American date in Deal input 2.xls. So even though the date in the current workbook is entered as 02/05/2008 the info gets transferred to deal input2.xls as 05/02/2008. I've played around by trying to change...
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
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
5270
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
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.