title: VBA How do you pass DATE as parameter to stored procedure
body: <p>Currently I pass the date parameter as varchar and convert because I got errors with passing  a date parameter. I still get errors but its a conversion parameter. </p>
  
  <pre><code>Sub GetPositions() 'xdate As Date
  Dim sSQL As String
  Dim rs As ADODB.Recordset
  Dim cn As ADODB.Connection
  Dim cmd As ADODB.Command
  Dim prm As ADODB.Parameter
  Set cmd = New ADODB.Command
  Set prm = New ADODB.Parameter
  
  
  
  Sheets("Positions").Select
  Range("a2:bb999999").ClearContents
  Set cn = New ADODB.Connection
  cn.CommandTimeout = 300000
  cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial     Catalog=GlobalR;Data Source=SWP"
  
      Dim d As Date
      d = "2013/12/03"
  
      cmd.ActiveConnection = cn
      cmd.CommandType = adCmdStoredProc
      cmd.CommandText = "Get9599Delta"
      cmd.NamedParameters = True
      Set prm = cmd.CreateParameter("@date", adVarChar, adParamInput, 12)
      cmd.Parameters.Append prm
      cmd.Parameters("@date").Value = "'12/3/2013'"
      Set rs = New ADODB.Recordset
      rs.Open cmd.Execute ''''I AM GETTING AN ERROR ON THIS LINE THAT READS
       ''''''''''' CONVERSION FAILED WHEN CONVERTING DATETIME TO CHARACTER STRING
  
  Cells(2, 1).CopyFromRecordset rs
  
  rs.Close
  Set rs = Nothing
  cn.Close
  Set cn = Nothing
  
  End Sub
  </code></pre>
  
  <p>here is my stored proc</p>
  
  <pre><code>alter PROC Get9599Delta (@date varchar(12))
  AS
  DECLARE @d DATETIME
  SET @d = CONVERT(DateTime, @date, 104) --convert the varchar to a date
  </code></pre>
  
  <p>Any idea why I am having this conversion issue?</p>