p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

activex_data_objects thread: Datatype mismatch in SQL criteria

Message #1 by "Hanson Lam" <hansonlam@h...> on Tue, 27 Nov 2001 05:21:50

I am trying to bring back a recordset using the following SQL statement.  

(the statement uses data shaping).  However, the YEAR keeps giving me a 

datatype mismatch in the criteria.  Any ideas?

I've put *** beside the problem area i think:

SHAPE {SELECT DISTINCTROW tblBrand.BrandName, tblTransaction.ModelNumber, 

Month([TransactionDate]) AS theMonth, Format$([tblTransaction].

[TransactionDate],'mmmm", "yyyy') AS dMonth, Count

(tblTransaction.InvoiceID) AS UnitSold, Year([TransactionDate]) AS theYear

FROM tblBrand INNER JOIN tblTransaction ON tblBrand.BrandID = 


GROUP BY tblBrand.BrandName, tblTransaction.ModelNumber, Month

([TransactionDate]), Format$([tblTransaction].

[TransactionDate],'mmmm", "yyyy'), Year([TransactionDate])

HAVING (((Year([TransactionDate]))= 2001))   ***

ORDER BY tblBrand.BrandName, tblTransaction.ModelNumber, Month


}  AS AnnualBrandSales COMPUTE AnnualBrandSales BY 'BrandName'


H Lam

  Return to Index