By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,945 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,945 IT Pros & Developers. It's quick & easy.

Problem with recordset.fields(i).Type, it doesn't give the type name?

P: 2
I need to create a temporary table in VBA Code but recordset.fields(i).Type gives me an integer value instead of the required field's Type. For an example Field_Name= "CriteriaName" and it's Field_Type=Text.

Following Code doesn't give me the type of the field name, it just give me the integer value. Problem with recordset.fields(i).Type.

Could anyone please help me out with this? im really stuck at the momemnt?


sString = "CREATE TABLE COMPONENT("

For i = 0 To rsCreateTable.Fields.Count - 1

If i = rsCreateTable.Fields.Count - 1 Then

sString = sString + rsCreateTable.Fields(i).Name + " " + rsCreateTable.Fields(i).Type

Else

sString = sString + rsCreateTable.Fields(i).Name + " " + rsCreateTable.Fields(i).Type + ", "

END IF

Next i

sString = sString + ") "
Debug.Print sString
DoCmd.RunSQL sString
Oct 9 '07 #1
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
I guess the values you get are described here:

TypeValue TypeConstant TypeDescription
1 dbBoolean Boolean
2 dbByte Byte
3 dbInteger Integer
4 dbLong Long
5 dbCurrency Currency
6 dbSingle Single
7 dbDouble Double
8 dbDate Date/Time
9 dbBinary Binary
10 dbText Text
11 dbLongBinary Long Binary (OLE Object)
12 dbMemo Memo
15 dbGUID GUID
16 dbBigInt Big Integer
17 dbVarBinary VarBinary
18 dbChar Char
19 dbNumeric Numeric
20 dbDecimal Decimal
21 dbFloat Float
22 dbTime Time
23 dbTimeStamp Time Stamp

Just use the TypeConstant when you want to determine the type without referring to the number.

Nic;o)
Oct 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.