473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Selecting Records between two date fields

Hello!

Hope y'all can help me. I've just started to use Access and just
putting together some simple asp pages for my band's website.

We've got a "latest news" table in our db and I want to create a
"what's on today" page which will select a article where today's date
falls between a field called startDate and the endDate field.

My SQL (from dreamweaver using vbscript) looks like:
"SELECT * FROM news WHERE newsStartDate < #" & date() & "# AND
newsEndDate > #" & date() & "# ORDER BY newsStartDate ASC

Unfortunately, it's not pulling any of the articles out....Grrr!

Any ideas?

Cheers
Tony

Nov 13 '05 #1
1 1794
to*********@yahoo.co.uk wrote in MESSAGE
<11*********************@g49g2000cwa.googlegroups. com> :
Hello!

Hope y'all can help me. I've just started to use Access and just
putting together some simple asp pages for my band's website.

We've got a "latest news" table in our db and I want to create a
"what's on today" page which will select a article where today's date
falls between a field called startDate and the endDate field.

My SQL (from dreamweaver using vbscript) looks like:
"SELECT * FROM news WHERE newsStartDate < #" & date() & "# AND
newsEndDate > #" & date() & "# ORDER BY newsStartDate ASC

Unfortunately, it's not pulling any of the articles out....Grrr!

Any ideas?

Cheers
Tony


I would guess a problem with date formatting - when feeding the Jet
engine
with an SQL string, it needs dates in an unambiguous format.

....newsStartDate < #" & format$(date(),"yyyy-mm-dd") & "# AND...

See http://allenbrowne.com/ser-36.html for more details.

--
Roy-Vidar

Nov 13 '05 #2

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

Similar topics

6
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form...
1
by: allyn44 | last post by:
Hello, I have a table that has null fields that need to be filled in with the value of the previous record (example below) id date 1 2/2/02 2 3 4/4/02 4
0
by: allyn44 | last post by:
HI--I have 2 tables Cut: cut ID, HistNumb, Block, date: Cut Id is the primary key, the other 3 fileds are indexed to be unique Slides: Cutid SlideID, and various other fields: there can be...
1
by: Anderson | last post by:
Can you please help? I have an appointment table and employees have multiple records in this table simple because their contracts change. The table has fields change date and reason for change...
2
by: rivka.howley | last post by:
I wrote some code that creates a table with a date/time field at 15-minute intervals. Here's how I create and populate the table With tblDataTemp ..Fields.Append .CreateField("CT_ID", dbLong)...
1
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected....
4
by: wishwish20 | last post by:
Hello, I am having trouble with an SQL query which is used as a source on a report. The database is being used to keep track of billing information. I have made an sql query, which has 2 tables....
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
8
by: Dr Al | last post by:
I have a table with four date fields, some of which may not be filled in based on our data entry needs. I have a criteria set as <date()-180 which is supposed to pull dates older than 180 days ago....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.