Database Properties Type name reference?

A

Alp Bekisoglu

Hi Experts,

Where shall I refer to inorder to find the name (in text) of the property
types that are returned as integer values?

There are apparently from 0 to 15 but I can't locate any reference that
lists which is DB_Text, etc...

Any help/guidance will be highly appreciated.

Thanks in advance.

Alp
 
A

Allen Browne

1. Press Ctrl+G to open the Immediate window.

2.Press F2 to open the Object Browser.

3. Search for
DB_Text

You will see it is a member of the OldConstants in the Access library.
The new constants do not have the underscore, so search for:
dbText
It is a member of DataTypeEnum in the DAO library.
The other members are listed there as well.

If it is any use, this function converts the number into a name:

Function FieldTypeName(n As Long) As String
'Purpose: Converts the numeric results of DAO fieldtype to text.
'Note: fld.Type is Integer, but the constants are Long.
Dim strReturn As String 'Name to return

Select Case n
Case dbBoolean
strReturn = "Yes/No" '1
Case dbByte
strReturn = "Byte" '2
Case dbInteger
strReturn = "Integer" '3
Case dbLong
strReturn = "Long Integer" '4
Case dbCurrency
strReturn = "Currency" '5
Case dbSingle
strReturn = "Single" '6
Case dbDouble
strReturn = "Double" '7
Case dbDate
strReturn = "Date/Time" '8
Case dbBinary
strReturn = "Binary" '9
Case dbText
strReturn = "Text" '10
Case dbLongBinary
strReturn = "OLE Object" '11
Case dbMemo
strReturn = "Memo" '12
Case dbGUID
strReturn = "GUID" '15
Case dbBigInt
strReturn = "Big Integer" '16
Case dbVarBinary
strReturn = "VarBinary" '17
Case dbChar
strReturn = "Char" '18
Case dbNumeric
strReturn = "Numeric" '19
Case dbDecimal
strReturn = "Decimal" '20
Case dbFloat
strReturn = dbFloat '21
Case dbTime
strReturn = "Time" '22
Case dbTimeStamp
strReturn = "Time Stamp" '23
Case Else
strReturn = "Field type " & n & "unknown"
End Select
FieldTypeName = strReturn
End Function
 
A

Alp Bekisoglu

Hi Allen,

Thank you for your reply and especially for the included code. Actually that
was the main thing I have been looking for; the integer type no vs the name.
Maybe I couldn't find it but this matching is not in the help, neither in
Access nor in VBA.

One final item left though; what is type 0? Connection property is refered
to as this type.

Thanks again.

Alp
 
A

Allen Browne

See if you can get to the Object Browser from the View menu of the code
window.

None of the constants in DataTypeEnum have value zero, so I'm not sure what
that was about. Several objects do have a Connection property, e.g.
CodeProject and CurrentProject in the Access library, Database and Recordset
in the DAO library.
 
A

Alp Bekisoglu

Actually after I sent my reply, I did notice the integer equivalents shown
below the list in the ObjectBrowser but it was too late...
The 0 value I get is by querying the database properties (all available).
Anyway, for the time being it is not that important since I do not intend to
change that value in any db. It would have been nice to have explanations of
each item in the ObjectBrowser once clicked on. My help is quite shaky so
maybe I owe this to it. I'll try to find a way to restore/repair it.
Thank you for your time and guidance Allen.

Alp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top