append parameter - data types in adp that correspond to sql data types

  • Thread starter Thread starter Keith G Hicks
  • Start date Start date
K

Keith G Hicks

Is there a chart somewhere that shows the related datatypes to use in the
code to create stored procedure parameters in ms access like in the
following:

.Parameters.Append .CreateParameter("@sPropState", adVarChar,
adParamInput, 2, Me.PropState)

as they compare to the data types in ms sql 2k?

For example, I have a "text" data type in my stored procedure as an input
parameter but there is no "adText" data type in vba. I'm not sure what to
use.

Thanks,

Keith
 
The file adovbs.inc (there is also a version for javascript) that you will
find on your machine contains them all but here's a transcript:
http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=122

You can also use a typelib instead:
http://www.asp101.com/articles/john/typelibs/default.asp

Don't forget that the name of the parameters is not important but that their
order is. Also, as you have a return value, you must add a parameter of
type adParamReturnValue and it must be the first of the list. Finally, you
can use a simple routine to retrieve the desired values:

Dim p As ADODB.Parameter
cmd.Parameters.Refresh

For Each p In cmd.Parameters
Debug.Print "name = " & p.name
Debug.Print "Direction = " & p.Direction
Debug.Print "Type = " & p.Type
Debug.Print "Size = " & p.Size
Debug.Print "Precision = " & p.Precision
Debug.Print "NumericScale = " & p.NumericScale
Debug.Print
Next
 
Back
Top