dbTalk Databases Forums  

VB Indexes For Data Types?

comp.databases.ms-access comp.databases.ms-access


Discuss VB Indexes For Data Types? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fester Bestertester
 
Posts: n/a

Default VB Indexes For Data Types? - 11-27-2007 , 06:57 PM






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...

Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: VB Indexes For Data Types? - 11-27-2007 , 07:15 PM






On Tue, 27 Nov 2007 16:57:11 -0800, Fester Bestertester
<whatmeworry (AT) mad (DOT) net> wrote:

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

-Tom.


Quote:
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...

Reply With Quote
  #3  
Old   
Stuart McCall
 
Posts: n/a

Default Re: VB Indexes For Data Types? - 11-27-2007 , 07:17 PM



"Fester Bestertester" <whatmeworry (AT) mad (DOT) net> wrote

Quote:
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.




Reply With Quote
  #4  
Old   
Allen Browne
 
Posts: n/a

Default Re: VB Indexes For Data Types? - 11-28-2007 , 03:18 AM



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" <whatmeworry (AT) mad (DOT) net> wrote

Quote:
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...

Reply With Quote
  #5  
Old   
Fester Bestertester
 
Posts: n/a

Default Re: VB Indexes For Data Types? - 11-28-2007 , 10:03 AM



Allen Browne wrote:
Quote:
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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.