I have been trying to design a query and have come across a very annoying problem. My query below works fine until I try to change the WHERE T0.CreateDate statement to ask the user for an input date.
T0.CardCode, T0.CardName, CASE WHEN t0.cardtype = 'L' THEN 'Lead' WHEN t0.cardtype = 'C' THEN 'Customer' WHEN
t0.cardtype = 'S' THEN 'Supplier'
CASE WHEN T0.QryGroup5 = 'Y' THEN 'Y' END AS Decorative, CASE WHEN T0.QryGroup6 = 'Y' THEN 'Y' END AS Labelling
FROM dbo.OCRD AS T0 INNER JOIN
dbo.OCRG ON T0.GroupCode = dbo.OCRG.GroupCode INNER JOIN
dbo.CRD1 AS T1 ON T0.CardCode = T1.CardCode INNER JOIN
dbo.OCTG ON T0.GroupNum = dbo.OCTG.GroupNum
WHERE T0.CreateDate <= '01.08.09'
When I change the last line to
WHERE T0.CreateDate <= '[%0]'
with or without ' ' marks. I get an error saying
Can anyone help point out what I have done wrong please?
Thanks In Advance