Add Method (Parameters Collection)

         Example         Applies To

Creates a new query parameter. Returns a Parameter object that represents the new query parameter.

Syntax

expression.Add(Name, DataType)

expression   Required. An expression that returns a Parameters object.

Name   Required String. The name of the specified parameter. The parameter name should match the parameter clause in the SQL statement.

DataType   Optional Variant. The data type of the parameter. Can be one of the following XlParameterDataType constants:

xlParamTypeBigInt

xlParamTypeBinary

xlParamTypeBit

xlParamTypeChar

xlParamTypeDate

xlParamTypeDecimal

xlParamTypeDouble

xlParamTypeFloat

xlParamTypeInteger

xlParamTypeLongVarBinary

xlParamTypeWChar

xlParamTypeNumeric

xlParamTypeLongVarChar

xlParamTypeReal

xlParamTypeSmallInt

xlParamTypeTime

xlParamTypeTimeStamp

xlParamTypeTinyInt

xlParamTypeUnknown

xlParamTypeVarBinary

xlParamTypeVarChar


These values correspond to ODBC data types. They indicate the type of value the ODBC driver is expecting to receive. Microsoft Excel and the ODBC driver manager will coerce the parameter value given in Microsoft Excel into the correct data type for the driver.