Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange error in report preview

Status
Not open for further replies.

kmclane

Technical User
Apr 14, 2004
321
US
I am getting a "Data type mismatch in criteria expression" error when trying to preview a report. I can run the underlying query with no problem, and there are no criteria. I can't figure this one out. Any ideas where to look?
Thanks, Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
Do you get the error if you remove all sorting and grouping? Do you have any subreports in the report? When you open the query, do you page through to the last record in the query? Are you attempting to open the report with a "where" clause?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Strangely enough, the only time it runs correctly is when I apply a filter. It has to be an exact filter though, I had no success with wildcards. I do have the report grouped on two items, agent name and salesrep number. I have code that outputs the reports one at a time in a module that sets the filter from a recordset, but that is run from a macro. I have been able to do a "print all" in the past so I could check my numbers. I tested last months copy to see if my changes had messed something up and I am getting the same error there as well. I have paged through all 9134 records in the query results without a problem. If there is a where, I don't know where it is. ;-)
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
Perhaps you should share "module that sets the filter from a recordset".

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
The module is not involved when previewing the report directly. I use it to output each indivual report to a pdf file. I also have several different versions of the report which are used for specific agents and the module subs those in at the proper time. With the filter field blank I should get the entire report, yes?
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
I would try re-create the report or remove code, controls, sections, etc one-by-one until the problem goes away. Keep track of what you just removed so that you know the culprit. If you can't figure out why the culprit exists, come on back.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
I found the problem. I do my filter on a sortcode that is 12 digits. The first 4 digits represent the bank involved in the transaction. 3003 is one bank, 3005 is another. 3004 is a separate code for the same bank as 3005, for future use. Someone set up a test account using that bank number and ran a transaction. AS this code only showed up in one table I was getting the error. I removed the record from the table and my error went away. Go figure. Thanks, Ken.

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top