Access db problem trying to retieve date

  • Thread starter Thread starter jtrainaldi
  • Start date Start date
J

jtrainaldi

Basically I am trying to access all entries from a database that equal
the current system date.

I am using an ASP page accessing an ACCESS DB. I am not getting any
errors but the database is not retrieving anything. However, when I do
a SELECT * FROM Events i get everything.

My code is:

SQL_query = "SELECT * FROM Event WHERE eventDate= 8/24/2006"

or

SQL_query = "SELECT * FROM Event WHERE eventDate= " & date

I tried both strings. The one was used to see if the code would work
if it was hard coded.

I was wondering if I am doing anything wrong. Please help me.
 
You are trying: WHERE eventDate = some very, very small number.
You are asking it: 8 divided by 24 divided by 2006 !

Try this:
"SELECT * FROM Event WHERE eventDate= #8/24/2006#"

The # denotes date/time values. Double quotes " denote a string. Without
either Access assumes numbers and math characters like / for division.

SQL_query = "SELECT * FROM Event WHERE eventDate= #" & Date() & "#"

Also make very sure that eventDate is not store both the date and time
otherwise it won't pick up records except those that match at midnight.
 
Thank you so very much. I put th # in front of the date but not after
it.


THANK YOU, this was really frustrating me

You are the man
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top