Data Type Mismatch - Why?

tweetyksc

Registered User.
Local time
Today, 16:17
Joined
Aug 23, 2001
Messages
87
I have a report that is based on totals query (which is based on another query). This ran just fine on Friday, but today I'm getting the "data type mismatch" error.

The base query, "qryProoflisting" runs just fine. This takes the date (which is a text field) computes the quarter, GP, etc. along with filtering out some lines. The second query, "qryProofCustSummary" which is just a totals query of the first one that runs just fine - is the one producing the error, and I can't figure out why.

qryProoflisting: (runs just fine)
---------------------------------------------------------
SELECT [YTD Proof Listing - 2003].[Sales Area], [YTD Proof Listing - 2003].[Business Partner], [YTD Proof Listing - 2003].[Business Partner Name], [YTD Proof Listing - 2003].[Employee Number], tblSalesReps.SalesRep, Format([Invoice Date],"00\/00\/0000") AS InvDate, Format([InvDate],"mmmm") AS Month, Format([InvDate],"yyyy") AS Year, DatePart("q",[invdate]) AS Qtr, [YTD Proof Listing - 2003].Item, IIf([Product Line]="","NONE",[Product Line]) AS ProdLine, [YTD Proof Listing - 2003].[PL Sales], [YTD Proof Listing - 2003].[PL Cost], [PL sales]-[PL cost] AS GP, IIf([item] Like "CW*" And [PL sales]<>0,"No") AS LineFlag
FROM [YTD Proof Listing - 2003] LEFT JOIN tblSalesReps ON [YTD Proof Listing - 2003].[Employee Number] = tblSalesReps.[Employee#]
WHERE (((IIf([item] Like "CW*" And [PL sales]<>0,"No")) Is Null))
ORDER BY [YTD Proof Listing - 2003].[Business Partner];
----------------------------------------------------------

qryProofCustSummary: (generates the error)
-----------------------------------------------------------------------
SELECT qryProofListing.[Sales Area], qryProofListing.[Business Partner], qryProofListing.[Business Partner Name], qryProofListing.SalesRep, qryProofListing.Qtr, qryProofListing.Year, Sum(qryProofListing.[PL Sales]) AS [SumOfPL Sales], Sum(qryProofListing.[PL Cost]) AS [SumOfPL Cost], Sum(qryProofListing.GP) AS SumOfGP
FROM qryProofListing
GROUP BY qryProofListing.[Sales Area], qryProofListing.[Business Partner], qryProofListing.[Business Partner Name], qryProofListing.SalesRep, qryProofListing.Qtr, qryProofListing.Year;
 
You might need to set a data type for any parameters in your queries by right-clicking in the query design view.

Or you are trying to perfom a calculation for data types that don't match.

That's all I can think of...
 
UPDATE:
I got this working.
Seems that someone put a "garbage" record in there, one that had all fields blank except for the customer number. I took that out and now it is working fine.
 
I know, you're absolutely right.
I got this thrown at me and then they are requesting multiple queries/reports, etc. which need to get out so unfortunately I'm operating on a "get it out now" basis...I'll need to fix these things so this won't happen again.
 

Users who are viewing this thread

Back
Top Bottom