stef4s,
What are trying to convert?
Is [cmi-core-score-raw] a number field?
If its a number in a text field then you could use:
SELECT AVG(val([cmi-core-score-ra
Note the addition of the Group By.
Pete
Main Topics
Browse All TopicsHey Experts
I've been forced to use MS Access (usually use MS SQL). Now I need to Average (AVG) a Field (type text 10)
Here is my SQL.
SELECT AVG([cmi-core-score-raw]) AS [average],[OrgID] FROM [SCOTracking]
SQL Error: -2147217913
Description: Data type mismatch in criteria expression.
Ok now in MS Sql Server I just use either CAST or CONVERT functions.
I can't seem to find any documentation on typecasting for MS Access. (In Access 2003 help)
1) Please provide me with location of documentation (Preffered)
or
2) Provide functions with descriptions and examples.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Actually, you do not need to explicitly convert the text to numeric format as it will be done implicitly by the AVG function.
Nor will it actually help to try explicitly converting the values. The DataType mismatch error occurs if at least one of the [cmi-core-score-raw] values being averaged is not numerical, and thus cannot be converted either way.
What you need to do is to ensure that you are only trying to average values that can be converted. To do this, simply use the IsNumeric function to filter out the junk.
SELECT AVG([cmi-core-score-raw]) AS [average],[OrgID]
FROM [SCOTracking]
WHERE IsNumeric([cmi-core-score-
GROUP BY [OrgID];
Business Accounts
Answer for Membership
by: datamarkcsPosted on 2005-08-31 at 06:57:50ID: 14793750
The function to use (or lookup in the help system) is cint or clong. These mean convert to integer or convert to long. There are more conversion functions. Look up functions. Of course, after you convert your text field to numbers, then you can average them.