Click to See Complete Forum and Search --> : Select record by next date


ProWeb
10-04-2007, 06:30 AM
Hi,

I have an access db with a table called events. The Events table is going to hold details of forthcoming events which I display chronologically. I have a field called EventDate, which is a Short Date (dd/mm/yyyy).

Im querying the table from an ASP via a DSN-less connection

I want to show the next forthcoming Event.

I used the query
SELECT TOP 1 FROM TBLevents WHERE Eventdate >= #04/10/2007# ORDER BY Eventdate ASC

this didn't work so I amended the query to select *
SELECT * FROM TBLevents WHERE Eventdate >= #04/10/2007# ORDER BY Eventdate ASC

This worked but even with the >= I still get dates from the past. The date comes from the following code;
EventDate = formatdatetime(date(),2)

I only want to display the next record based on date chronologically.

Thanks
Aran