Cross Tab - Data Type Mismatch in Criteria Expression

Access_Help

Registered User.
Local time
Yesterday, 19:17
Joined
Feb 12, 2005
Messages
136
Hi,

I am using a calculated field (set to general number) from a query to serve the vAlue field in the crosstab query. I am getting a data type mismatch error.

Is there anything I can do to resolve this?

 

Attachments

  • Capture.PNG
    Capture.PNG
    38.6 KB · Views: 310
TestMark is not numeric.
In the source query, qryMarkGrid,
set the field to CDBL(testMark),
(Or some other numeric conversion )
 
Did you apply any format() to your calculated field to get your Percentage. If you did, it will be formatted as a string, not a number.
 
Do you have any external criteria in your source wry_mark_grid which is coming direct from a Form? Would be more helpful if you can share that database or both queries.
 
Either of your Test Marks or AvailableMarks has zero value which is evaluting #DIV/0! error. Edit your calculation like below:
IIF(NZ([Test Mark],0)=0,0,IIF(NZ([AvailableMarks],0)=0,0,[Test Mark]/[AvailableMarks]*100))
 
Either of your Test Marks or AvailableMarks has zero value which is evaluting #DIV/0! error. Edit your calculation like below:
IIF(NZ([Test Mark],0)=0,0,IIF(NZ([AvailableMarks],0)=0,0,[Test Mark]/[AvailableMarks]*100))

Hi. Thank you.

Despite the editing, I am still getting the mismatch error. :(
 
In a cross tab query you have to explicitly declare any criteria as parameters. From the screen shots you don't appear to have any criteria.

Right click and select the parameters option - is there something left behind in there you don't need?
 
Hi,

I have attached the database.

It has the source query as well as the crosstab query.

The query works fine if the mark field is used as the SUM, however, if I use the percentage field which is a calculated field, it brings up a mismatch error.

View attachment Cross_Tab_Display_%.zip
 
You've some bad data with the full name "Student100".
Correct that and the query runs.
 
You've some bad data with the full name "Student100".
Correct that and the query runs.

Hi, I changed the data to preserve confidentiality, it still did not run prior to this.
 
Exclude the student. The problem is that AvailableMarks is stored as text it should be number, and for courses no. 148 you have some spaces after AvailableMarks= 42.
 

Attachments

Hey,

You need to change the datatype for AvailableMarks in Courses table from Text to Number. Somehow you have junk data in it which is why it's leading into an datatype conversion error.
 
Thank you so much for spotting these minor mistakes.
Whether it is minor or major error, depend on how you look at it.
It seems to have been a major one for you, because you couldn't run your query and you couldn't find the error even though I told you that you had some bad data. :D :D
 

Users who are viewing this thread

Back
Top Bottom