VB Indexes For Data Types?

VB Indexes For Data Types?

am 28.11.2007 01:57:11 von Fester Bestertester

Greetings,

I'm still using MS Access 2K3 and DAO 3.6 objects (I know, I know, I'm a
dinosaur)...

I'm traversing through the fields of a table to retrieve their data
types, thus,

Dim columntype as variant
Set db = CurrentDb()
Set tdf = db.TableDefs("MyTable")
columncount = tdf.Fields.Count
For i = 0 To columncount
columntype = tdf.Fields(i).Type
Next i

What's happening is that "columntype = tdf.Fields(i).Type" is returning
an integer, i.e, for a field of type "Text", it returns a "10", for a
field of type "Number|Integer", it returns a "7", etc.

Evidently these various data types have associated VB indexes. But I
can't for the life of me find a page anywhere in Help or on the web that
maps these VB integer values to their associated field data types. Help,
anyone? I know, it's probably right under my nose somewhere...

Re: VB Indexes For Data Types?

am 28.11.2007 02:15:47 von Tom van Stiphout

On Tue, 27 Nov 2007 16:57:11 -0800, Fester Bestertester
wrote:

Code window > F2 to open the object browser > select DAO library and
look around. The DataTypeEnum sounds promising.

-Tom.


>Greetings,
>
>I'm still using MS Access 2K3 and DAO 3.6 objects (I know, I know, I'm a
>dinosaur)...
>
>I'm traversing through the fields of a table to retrieve their data
>types, thus,
>
>Dim columntype as variant
>Set db = CurrentDb()
>Set tdf = db.TableDefs("MyTable")
>columncount = tdf.Fields.Count
>For i = 0 To columncount
> columntype = tdf.Fields(i).Type
>Next i
>
>What's happening is that "columntype = tdf.Fields(i).Type" is returning
>an integer, i.e, for a field of type "Text", it returns a "10", for a
>field of type "Number|Integer", it returns a "7", etc.
>
>Evidently these various data types have associated VB indexes. But I
>can't for the life of me find a page anywhere in Help or on the web that
>maps these VB integer values to their associated field data types. Help,
>anyone? I know, it's probably right under my nose somewhere...

Re: VB Indexes For Data Types?

am 28.11.2007 02:17:35 von Stuart McCall

"Fester Bestertester" wrote in message
news:fiiedn$1ag$1@gondor.sdsu.edu...
> Greetings,
>
> I'm still using MS Access 2K3 and DAO 3.6 objects (I know, I know, I'm a
> dinosaur)...
>
> I'm traversing through the fields of a table to retrieve their data types,
> thus,
>
> Dim columntype as variant
> Set db = CurrentDb()
> Set tdf = db.TableDefs("MyTable")
> columncount = tdf.Fields.Count
> For i = 0 To columncount
> columntype = tdf.Fields(i).Type
> Next i
>
> What's happening is that "columntype = tdf.Fields(i).Type" is returning an
> integer, i.e, for a field of type "Text", it returns a "10", for a field
> of type "Number|Integer", it returns a "7", etc.
>
> Evidently these various data types have associated VB indexes. But I can't
> for the life of me find a page anywhere in Help or on the web that maps
> these VB integer values to their associated field data types. Help,
> anyone? I know, it's probably right under my nose somewhere...

Search help for VarType Constants.

Re: VB Indexes For Data Types?

am 28.11.2007 10:18:43 von Allen Browne

Tom and Stuart have explained how to get these values for yourself.

Here's a bit of code you can use to return the file type names:
http://allenbrowne.com/func-06.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Fester Bestertester" wrote in message
news:fiiedn$1ag$1@gondor.sdsu.edu...
> Greetings,
>
> I'm still using MS Access 2K3 and DAO 3.6 objects (I know, I know, I'm a
> dinosaur)...
>
> I'm traversing through the fields of a table to retrieve their data
> types, thus,
>
> Dim columntype as variant
> Set db = CurrentDb()
> Set tdf = db.TableDefs("MyTable")
> columncount = tdf.Fields.Count
> For i = 0 To columncount
> columntype = tdf.Fields(i).Type
> Next i
>
> What's happening is that "columntype = tdf.Fields(i).Type" is returning
> an integer, i.e, for a field of type "Text", it returns a "10", for a
> field of type "Number|Integer", it returns a "7", etc.
>
> Evidently these various data types have associated VB indexes. But I
> can't for the life of me find a page anywhere in Help or on the web that
> maps these VB integer values to their associated field data types. Help,
> anyone? I know, it's probably right under my nose somewhere...

Re: VB Indexes For Data Types?

am 28.11.2007 17:03:29 von Fester Bestertester

Allen Browne wrote:
> Tom and Stuart have explained how to get these values for yourself.
>
> Here's a bit of code you can use to return the file type names:
> http://allenbrowne.com/func-06.html
>
Cool. Many thanks for all the responses.