Link to home
Start Free TrialLog in
Avatar of JoseDavila
JoseDavilaFlag for United States of America

asked on

Data type mismatch in critia expression when sorting

I am trying to sort the TTLotID field, but I get the data type mismatch error.  Why is that and how can I fix it?


SELECT CLng(Replace([Litho Data].[TTLotID],"-","")) AS LotID
FROM [Litho Data];
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Probably due to Null values. Try:

SELECT CLng(Replace(Nz([Litho Data].[TTLotID],"0"),"-","")) AS LotID
FROM [Litho Data];
Avatar of JoseDavila

ASKER

NO.  It still has the same error.
You say you were trying to sort by the TTLotID field - I assume you mean you were trying to sort by the new LotID field?
Correct.  
Hmm. What version of Access and what service pack?
2002.
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is [TTLotID] in the table [Litho Date] a text field?

Patrick
I presume the value of TTLotID after the replace is less than 2,147,483,647.  That is the largest positive integer CLng will support.