varData = fld.Type returns a value 7. is this the identifier?

J

Jack

Set tdf = dbs1.TableDefs(strThis)
For Each fld In tdf.Fields
strFldNm = Trim(fld.Name)
varData = fld.Type
If varData = "Date/Time" Then
rstTBL![HasDateData] = -1
End If
Next fld

The above code is a snippet from a routine that searches every user table in
a database and looks for a DataType of 'Date/Time'. The return in the
immediate window is a 7 for varData. Is this a moniker or identifier for the
Field Type and if so where is a list to associate that with a type
description ie. 7 = Text. If not, what on earth is it?
 
B

Brendan Reynolds

It's an Enum, more specifically it's the DAO DataTypeEnum. (If you don't
know what an Enum is, you could think of it as a set of related constants).
To see the list, type the word DataTypeEnum in the Immediate window (don't
press Enter or Space or anything else after the last character) then hold
down the Shift key while pressing the F2 key.

By the way, a value of 7 indicates that the field is not a Date/Time field,
it's a Double. A Date/Time field would return a value of 8.
 

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