View Full Version : parameter conversion


polynaux
04-06-2007, 12:35 PM
Hi Guys,

I am using MS Access 2007 and have the following query:

SELECT HoursLostThroughAccident
FROM Accidents
WHERE AccidentDate LIKE ? +'%'

The error I get after selecting values from a drop down list like 2001 or 2002 is:

'Failed to convert parameter values from a string to a datetime'

Is there a way that access converts the values like 2001 to something like
01.01.2001 and the values which have dates that are in the year 2001 will be displayed?

Thanks for any suggestions,

Phil

Jon K
04-06-2007, 05:27 PM
Try the Year() function.

SELECT HoursLostThroughAccident
FROM Accidents
WHERE Year(AccidentDate)= ?
.

polynaux
04-07-2007, 12:12 AM
it worked thanks you very much