Stuart McLachlan
stuart at lexacorp.com.pg
Sat Jun 25 22:43:10 CDT 2005
On 25 Jun 2005 at 20:34, John W. Colby wrote: > objects stored in a database container (a form or control). As for fields > in tables, I know that DAO can do so, I have no idea whether ADO could > return the data type of a field in a table. Is this possible? > Function ListFieldTypes() Dim cnn As ADODB.Connection Dim rst As New ADODB.Recordset Dim lngLoopcount As Long Set cnn = CurrentProject.Connection rst.ActiveConnection = cnn rst.Open Source:="tbltest", ActiveConnection:=cnn For lngLoopcount = 0 To rst.Fields.Count - 1 Debug.Print rst.Fields(lngLoopcount).Type Next End Function Type returns a constant defined in ADODB.DataTypeEnum ' ADODB.DataTypeEnum Const adBigInt = 20 Const adBinary = 128 Const adBoolean = 11 Const adBSTR = 8 Const adChapter = 136 Const adChar = 129 Const adCurrency = 6 Const adDate = 7 Const adDBDate = 133 Const adDBFileTime = 137 Const adDBTime = 134 Const adDBTimeStamp = 135 Const adDecimal = 14 Const adDouble = 5 Const adEmpty = 0 Const adError = 10 Const adFileTime = 64 Const adGUID = 72 Const adIDispatch = 9 Const adInteger = 3 Const adIUnknown = 13 Const adLongVarBinary = 205 Const adLongVarChar = 201 Const adLongVarWChar = 203 Const adNumeric = 131 Const adPropVariant = 138 Const adSingle = 4 Const adSmallInt = 2 Const adTinyInt = 16 Const adUnsignedBigInt = 21 Const adUnsignedInt = 19 Const adUnsignedSmallInt = 18 Const adUnsignedTinyInt = 17 Const adUserDefined = 132 Const adVarBinary = 204 Const adVarChar = 200 Const adVariant = 12 Const adVarNumeric = 139 Const adVarWChar = 202 Const adWChar = 130 -- Stuart