Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on an old VB6 project and I'm modifiying a crystal report. Every time I try to view the report it gives me an error "Data type mismatch in Criteria expression". I even tried removing all the parameters and Formula fileds I created but it still gives the same erorr. How do I fix that??
Posted

Read some of these posts, they may give you an idea of what is going wrong. Without you providing some relevant code snippets, it's the best I can do for you right now.

http://www.andreavb.com/forum/viewtopic_1379.html[^]
http://www.dreamincode.net/forums/topic/48673-error-message-data-type-mismatch-in-criteria-expression/[^]
http://www.vbforums.com/showthread.php?t=461948[^]
http://www.xtremevbtalk.com/showthread.php?t=139130[^]

If found all of these with 1 google search: data type mismatch in criteria expression VB6
 
Share this answer
 
Comments
walterhevedeich 7-Jul-11 21:32pm    
That's what I did too. Man, you're fast. :)
fjdiewornncalwe 7-Jul-11 22:05pm    
Today yes, most other days... Not so much.
One possible reason is that you might be passing a numerical field as a character field. Take a look at this for instance. If intValue is a numerical field, this will definitely throw an exception.

SELECT * FROM tblTable WHERE intValue = '1'


My advise would be for you to take a look at your queries first.
 
Share this answer
 
Comments
obhasha07 8-Jul-11 1:39am    
you're right. There is something wrong in the query. But sadly, I can't check or change the query because crystal reports gives me an error saying "A number is required here" when I try to view the query. Any ideas?
walterhevedeich 8-Jul-11 2:00am    
Why aren't you able to change the queries? Isn't the queries done on the VB6 code?
obhasha07 8-Jul-11 2:04am    
no, I don't pass a data set or run a query from vb. The query in in the crystal report. It's automatically created as we add database fields to the report

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900