I am looking to pass a date variable from Access to a SQL Server stored procedure. Please see my code:
VBA:
searchDate = 03/07/2014
cmd.Parameters.Append _
cmd.CreateParameter("@searchDate", adDBTimeStamp, adParamInput, , searchDate)
searchDate is a date formatted as MM/DD/YYYY
SQL:
ALTER PROCEDURE [dbo].[spAppendActivity]
@searchDate as datetime,
AS
SET NOCOUNT ON;
delete * from tbl_activity_losses;
select [Date]
into tbl_activity_losses
from tbl_master_rec
where [Date] = @searchDate
I get an ODBC error stating
[Microsoft][ODBC SQL Server Driver] Conversion failed when converting date and/or time from character string.
Any help on how to pass this date field to my stored procedure would be greatly appreciated.
@searchDatein your sproc. I bet it will be very different from what you think you are sending.adDBTimeStamp?adVarCharwork?