Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / May 2008

Tip: Looking for answers? Try searching our database.

Date fields break GROUP By or ORDER By clauses

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
colin_e - 19 May 2008 20:18 GMT
I'm beginning to question my own sanity here.

I have a simple query that derives these fields:

UID Firstname Lastname Registered Updated Accessed Num

The fields Registered Updated Accessed are strings in the underlying tables,
but converted to Date using DateValue() in the Query (no errors).

I then wanted to create a simple report on the lifespan (time between
registered date and accessed date). The function DateDiff("ww",  
a.registered, a.accessed) calculates the lifespan of the account in weeks.
This works ok in a SELECT.

However the following query fails:

SELECT *
FROM Accounts_Accessed AS a
ORDER BY DateDiff("ww",  a.registered, a.accessed) DESC;

Fails with the error:

"Data type mismatch in criteria expression". All the values being used here
are Dates, so i'm confused as to what's going on.

The only hint I have is that I started having this trouble after I built the
DateValue() conversion into the intermediate Query. Before that I was
processing everything as strings and then converting to dates only when I
needed to do date calculations, but this was a pain to remember when the
conversions were needed.

Can access really not handle WHERE clauses when types are converted in
intermediate queries?
Signature


Regards: Colin

KARL DEWEY - 19 May 2008 21:35 GMT
>>The fields Registered Updated Accessed are strings in the underlying tables,
but converted to Date using DateValue() in the Query (no errors).

Post the SQL for the query.
Signature

KARL DEWEY
Build a little - Test a little

> I'm beginning to question my own sanity here.
>
[quoted text clipped - 29 lines]
> Can access really not handle WHERE clauses when types are converted in
> intermediate queries?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.