title: ADO Command object in msaccess
body: <p>I don't understand why the following code is failing. Unfortunately to be able to reproduce the problem you must create a valid mysql connection object, or at least another ODBC compatible database.</p>
  
  <p>The following code basically calls a stored procedure like for example <code>CALL my_procedure(12345);</code></p>
  
  <p>The code:  </p>
  
  <pre><code>' Create ADODB Connection object
  Dim oConn As Object
  Set oConn = CreateObject("ADODB.Connection")
  Const MYSQL_DRIVER = "{MySQL ODBC 5.1 Driver}"
  Const MYSQL_SERVER = "10.32.27.6"
  Const MYSQL_DATABASE = "sales"
  Const MYSQL_USER = "root"
  Const MYSQL_PASSWORD = "xxxxxx"
  oConn.ConnectionString = "DRIVER=" &amp; MYSQL_DRIVER &amp; ";Server=" &amp; MYSQL_SERVER &amp; ";Database=" &amp; MYSQL_DATABASE &amp; ";Uid=" &amp; MYSQL_USER &amp; ";Pwd=" &amp; MYSQL_PASSWORD &amp; ";"
  oConn.Open
  
  
  ' parameter value
  Dim lngAssemblyId As Long
  lngAssemblyId = 12345
  
  
  ' Create ADODB.Command
  Const adCmdText = 1
  Const adParamInput = 1
  Const adInteger = 3
  
  Dim cmd As Object
  Set cmd = CreateObject("ADODB.Command")
  
  With cmd
      Set .ActiveConnection = oConn
      .CommandType = adCmdText
      .CommandText = "CALL my_procedure(?)"
      .Prepared = True
      .Parameters.Append .CreateParameter(, adInteger, adParamInput, , lngAssemblyId)
  
  End With
  
  
  ' execute command
  Call cmd.Execute
  Set cmd = Nothing
  </code></pre>
  
  <p>The code above will generate the error "Parameter Type is not supported." at the line <code>Call cmd.Execute</code></p>
  
  <p>I have found a couple of fixes but I don't understand why they work!</p>
  
  <p><strong>Fix 1</strong><br>
  a) Add a reference to "Microsoft ActiveX Data Objects 2.8 Library"<br>
  b) Then Change this part of the code:  </p>
  
  <pre><code>Dim cmd As Object
  Set cmd = CreateObject("ADODB.Command")
  </code></pre>
  
  <p>with this code:  </p>
  
  <pre><code>Dim cmd as New ADODB.Command
  </code></pre>
  
  <p><strong>Fix 2</strong><br>
  Change the value of adInteger from 3 to 20. The value of 20 represents adBigInteger from the ADODB.DataTypeEnum instead of adInteger. adBigInteger is an 8 byte data type whereas the 'long' datatype in vba and the 'INT' datatype in mysql are both 4 byte data types so this doesn't make sense.</p>
  
  <p><strong>Fix3</strong><br>
  Change the variable type of lngAssemblyId from Long to Integer. This is strange because 1) I don't need to limit the variable to an Integer in fix 1.<br>
  <strong>EDIT</strong>: changing the data type to 'Variant' also works without the drawback of limiting to an integer.</p>