Solved

Date comparison after format cdate

Posted on 2006-10-30
2
494 Views
Last Modified: 2008-03-17
I have a linked csv table that contains a date in the format of Oct 2006 and my link spec brings it in as text.
This query works ok:
SELECT Format(CDate([Month]),"yy/mm") AS Expr1
FROM tblPCGoogleReport;

this query works ok:
SELECT Format(CDate([Month]),"yy/mm") AS Expr1
FROM tblPCGoogleSLXMatch INNER JOIN tblPCGoogleReport ON tblPCGoogleSLXMatch.[Google Account Name] = tblPCGoogleReport.Account
ORDER BY Format(CDate([Month]),"yy/mm");

this query errors with data type mismatch:
SELECT Format(CDate([Month]),"yy/mm") AS Expr1
FROM tblPCGoogleReport
ORDER BY Format(CDate([Month]),"yy/mm");

I don't understand why I get an error in the 3rd query...any ideas?


0
Comment
Question by:avoorheis
2 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 total points
ID: 17835432
isnt the 3rd query the same as the 1st except u have ordering?

try ordering using columnn numbers
e.g.

SELECT Format(CDate([Month]),"yy/mm") AS Expr1
FROM tblPCGoogleReport
ORDER BY 1


only other thing is perhaps [Month] contains nulls or an invalid date
0
 

Author Comment

by:avoorheis
ID: 17835507
Silly me, for expecting to be sent clean data. Yes, there was a record that had bad data.

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now