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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 97 Select Query using Date in Where clause not working.

Status
Not open for further replies.

Slugmaster

Programmer
Jan 15, 2001
18
0
0
US
I have a very simple query based from a very simple table that I cannot get to work.

Table1:
Field1: TAG, Text
Field2: TimeModified, Date

Query1:
SQL: SELECT Table1.TAG, Table1.TimeModified
FROM Table1
WHERE (((Table1.TimeModified)=#4/12/2001 10:39:35#));

The output of the Query is nothing, even though the first entry in Table1 is:

TAG = test
TimeModified = 4/12/01 10:39:35 AM

Any idea why this query does not show a result?

 
if the seconds are different even though it dosen't display it won't show up.

what you should do is use the format function.
eg.
SQL: SELECT Table1.TAG, Table1.TimeModified
FROM Table1
WHERE Format(Table1.TimeModified, "m/d/yyyy")=#4/12/2001#;

or whichever format you want to search by.

HTH

PsychPt@Hotmail.com
 
That did not seem to work, if you don't mind, can I send you an email with a sample database?
 
Add AM or PM to the end of the criteria.

OR

format the date to match your criteria.

SELECT table1.ID, table1.TimeModified
FROM table1
WHERE (((Format$([table1].[TimeModified],"mm/dd/yy hh:nn:ss"))="05/03/01 10:51:03"));


As you can se, if you do this you'll need to put " around your criteria rather than #. Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top