473,394 Members | 1,866 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.

filter results to display those older than 'today'?

I've been going round in circles here trying to get this to work and my
ignorance of ASP is now showing me up.

I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in the
database.

i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'

I have tried to do this by;

Dim strSQL
Dim showdate

showdate = Date

then...

strSQL = "Select * FROM my_database WHERE my_date <" & showdate

Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when I
use i get all results displayed, when i use < I get none at all.

thanks for any help

Oct 30 '06 #1
6 1694
Please tell us what kind of database you're using.

Ray at work

"supasnail" <su*******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
I've been going round in circles here trying to get this to work and my
ignorance of ASP is now showing me up.

I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in the
database.

i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'

I have tried to do this by;

Dim strSQL
Dim showdate

showdate = Date

then...

strSQL = "Select * FROM my_database WHERE my_date <" & showdate

Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when I
use i get all results displayed, when i use < I get none at all.

thanks for any help

Oct 30 '06 #2
sorry, its an access database .mdb

S

Ray Costanzo [MVP] wrote:
Please tell us what kind of database you're using.

Ray at work

"supasnail" <su*******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
I've been going round in circles here trying to get this to work and my
ignorance of ASP is now showing me up.

I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in the
database.

i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'

I have tried to do this by;

Dim strSQL
Dim showdate

showdate = Date

then...

strSQL = "Select * FROM my_database WHERE my_date <" & showdate

Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when I
use i get all results displayed, when i use < I get none at all.

thanks for any help
Oct 30 '06 #3
I don't know if it makes any difference but I have the database field
set to date/time, and "short Date" and am using a
<%session.lcid=1046%on the results page ( I know this is really for
Portugal but the 2057 for UK never displays as UK date format should,
not for me anyway.)
The Access database can be written to and read from happily and
displays the date correctly. I just dont seem to be able to work out
how to filter with respect to todays date.

S

An Access
supasnail wrote:
sorry, its an access database .mdb

S

Ray Costanzo [MVP] wrote:
Please tell us what kind of database you're using.

Ray at work

"supasnail" <su*******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
I've been going round in circles here trying to get this to work and my
ignorance of ASP is now showing me up.
>
I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in the
database.
>
i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'
>
I have tried to do this by;
>
Dim strSQL
Dim showdate
>
showdate = Date
>
then...
>
strSQL = "Select * FROM my_database WHERE my_date <" & showdate
>
Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when I
use i get all results displayed, when i use < I get none at all.
>
thanks for any help
>
Oct 30 '06 #4
Format the date accordingly then, YYYY-MM-DD. See here:
http://www.aspfaq.com/show.asp?id=2023

Sample:

Function dtForAccess(d)
dtForAccess = Year(d) & "-" & Right("0" & Month(d), 2) & "-" & Right("0"
& Day(d), 2)
End Function

Ray at work
"supasnail" <su*******@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
sorry, its an access database .mdb

S

Ray Costanzo [MVP] wrote:
>Please tell us what kind of database you're using.

Ray at work

"supasnail" <su*******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googleg roups.com...
I've been going round in circles here trying to get this to work and my
ignorance of ASP is now showing me up.

I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in the
database.

i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'

I have tried to do this by;

Dim strSQL
Dim showdate

showdate = Date

then...

strSQL = "Select * FROM my_database WHERE my_date <" & showdate

Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when I
use i get all results displayed, when i use < I get none at all.

thanks for any help

Oct 30 '06 #5
supasnail wrote:
I've been going round in circles here trying to get this to work and
my ignorance of ASP is now showing me up.

I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in
the database.

i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'

I have tried to do this by;

Dim strSQL
Dim showdate

showdate = Date

then...

strSQL = "Select * FROM my_database WHERE my_date <" & showdate

Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when
I use i get all results displayed, when i use < I get none at all.

thanks for any help
If you want today's date, then use the Date() function:

strSQL = "... WHERE my_date < Date"
--
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.
Oct 30 '06 #6
Thanks Bob, thats perfect - I was on the right lines but you've allowed
me to put everything in the right place lol. Now,... on to my next
headache lol

thank you very much

S

Bob Barrows [MVP] wrote:
supasnail wrote:
I've been going round in circles here trying to get this to work and
my ignorance of ASP is now showing me up.

I want to construct a query string to allow me to filter entries to be
displayed on a web page with respect to the date-entry contained in
the database.

i.e. an archived results page will show all entries where "my_date" is
less than 'todays date'

I have tried to do this by;

Dim strSQL
Dim showdate

showdate = Date

then...

strSQL = "Select * FROM my_database WHERE my_date <" & showdate

Although this does give a result, it has no actual bearing on todays
date and wondered what strinkingly obvious this I'm doing wrong? when
I use i get all results displayed, when i use < I get none at all.

thanks for any help
If you want today's date, then use the Date() function:

strSQL = "... WHERE my_date < Date"
--
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.
Oct 30 '06 #7

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

Similar topics

4
by: Phil Powell | last post by:
http://www.php.net/array_filter I went there at first for my information on filtering mySQL query results using PHP, to no avail. This is more of a Vignette construct (my native environment)...
1
by: Edward Burns | last post by:
I am trying to create an events calendar with a complete month view. I want to be able to get all the events for a particular month, using only one recordset on the page then be able to loop...
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
2
by: Terry | last post by:
I have cerated a Form, ExamsFrm, which is used to input details of exams taken at several Centres. It dosplays details from StudentTbl and has a SubForm which displays details from ExamsTble. I...
8
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and...
3
by: D. Shane Fowlkes | last post by:
(still a .NET newbie) I have a chunk of code in a Page_Load routine that pulls data from a SQL Server table. The Select statement looks for any "events" scheduled for today. Then my IF...
8
by: Smudger | last post by:
How can I place a filter on my datagrid only to view specific records ? The query In SQL would be: SELECT * FROM Orders WHERE dispatched = X The filter will be applied on the click event...
2
by: leeperman | last post by:
In Dreaweaver I cannot filter my database results to display only specific data that is retrieved from mulptile drop down list on my search page. The drop down list selections are posted to my...
1
by: Vivienne | last post by:
Hi there This is a hard problem that I have - I have only been using sql for a couple of weeks and have gone past my ability level quickly! The real tables are complex but I will post a simple...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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,...
0
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...
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.