Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS ACCESS and DATES ???????

Status
Not open for further replies.

pwel

Programmer
Aug 18, 1999
79
GB
Can anyone help with the folowing??

All I want to do is list the rows where the date is greater than todays date, below is what I have:

<%
dim conn
dim gigsRS
dim datToday
dim sqlTxt
datToday = Date()
set gigsRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;DSN=wellyDSN&quot;
sqlTxt = &quot;SELECT dayOfWeek, gigDate, nameOfNight, venue, townCity FROM gigsTable WHERE gigDate >= #&quot; & datToday & &quot;# ORDER BY gigDate&quot;
gigsRS.Open sqlTxt, conn
%>

This just lists all the records in the DB. The DB field is in Short Date format (04/09/01), and the date produced by Date() is also Short Format...

But the only way I can get it to work is if I hard code the datToday variable with the following format:

datToday = &quot;04/09/2001&quot;

Can I produce a date in asp with a 4 digit year????

Any help with this will be much appreciated..

Cheers in advance..

Paul.
 
I would use DateDiff() also but you can wrap the dates in the FormatDateTime() function and that will do it also.

Matt Ulmer
 
In msaccess query this date problem mostly depend upon the system date format.i already met the same problem.i solved it by using date format as &quot;dd-mmm-yy&quot;.


here is the code for u
----------------------------------

datToday=Format(Date,&quot;dd-mmm-yy&quot;)

sqlTxt = &quot;SELECT dayOfWeek, gigDate, nameOfNight, venue, townCity FROM gigsTable WHERE gigDate >= #&quot; & datToday & &quot;# ORDER BY gigDate&quot;
%>
--------------------------

try this.i hope this will help to solve ur problem

raghu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top