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

Access with ColdFusion

Status
Not open for further replies.

micjohnson

Programmer
Nov 9, 2000
86
0
0
US
I am using MS Access as my database for my small ColdFusion application that has 6 or 7 pages overall. My question is when i fetching recrods from database based on the date. Query is working sometimes and not sometimes.

SELECT *
FROM tblHomeBudget
WHERE DateValue(dtReceipt) = '01/01/2006'

I have several rows on my database but query returns 0 records.

I tried with Format(dtReceipt, "MM/DD/YYYY") also. This thing giving me an error.


Same thing for DATEPART("YYYY", dtReceipt) = '2006'
and DATEPART("M", dtReceipt) = '01'

Please advice me.

Thanks in advance.
 
What about:
Code:
SELECT *
FROM tblHomeBudget
WHERE DateValue(dtReceipt) = #01/01/2006#


Is the date field in your table formatted as date/time or text?


~Melagan
______
"It's never too late to become what you might have been.
 
Thank you Melagan!

Query with "WHERE DateValue(dtReceipt) = #01/01/2006#" is working well. But while i am using

WHERE DATEPART("yyyy", dtReceipt) = "2006"
AND DATEPART("m", dtReceipt) = "01" on another query to show the report, it is not working.

Regards
micJ
 
Don't compare numbers to strings/text.

WHERE DATEPART("yyyy", dtReceipt) = 2006
AND DATEPART("m", dtReceipt) = 1

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks a lot dhookom and Melagan. Queries are working now. (Sorry i am new to MS Access) Thanks for your time.

Regards
micJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top