Extract records whose Date is greater than [somedate]?

  • Thread starter Pooja Raisingani via AccessMonster.com
  • Start date
P

Pooja Raisingani via AccessMonster.com

Hi All,

I need to extract all the records whose regdate is greater than 12/13/2003.


But the following access query returns only the records upto 12/31/2003..
My Database includes

the records of the year 2004 n 2005. What shld i include in my query so
that it returns the dates of

2004, 2005 also?

SELECT *
FROM DefectMaster
WHERE Format(DateValue([DefectMaster].[RegDate]),"mm/dd/yyyy")>DateValue
(#12/13/2003#);

Thanks
 
T

Tom Lake

If RegDate is already a Date field, try this:

WHERE [DefectMaster].[RegDate]>#12/13/2003#;

Tom Lake
 
P

Pooja Raisingani via AccessMonster.com

RegDate is a DATETIME field.. Like
For example:
RegDate
1/1/2005 12:17:00 AM
12/31/2004 7:40:00 PM
12/31/2004 10:20:00 PM
12/31/2004 9:20:00 PM
12/31/2004 9:20:00 PM
12/31/2004 8:30:00 PM
1/1/2005 12:50:00 AM

so first of all i have extracted date from datetime field RegDate. The code
which u suggested doesnt work.
 
G

Guest

Do not format the date, by making it a string you are searching a string not
a number. Just search on the date with no formatting.
 
J

John Spencer (MVP)

SELECT *
FROM DefectMaster
WHERE DateValue([DefectMaster].[RegDate])> #12/13/2003#

Or even simpler

SELECT *
FROM DefectMaster
WHERE [DefectMaster].[RegDate] >= #12/14/2003#
 

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

Similar Threads


Top