Table Data Types?

G

Guest

Hi,

Is there a function that will return the Data Type for a field in a Table?

It would be great if I could set my Query RowsourceType to "Fields" and
after update, would generate the Data Type for the field chosen. Anyone know
this one?

I tried VarType() but I don't think that was it. Maybe I need to create a
Recordset and then do VartType(rst![MyField)), something like that?

Anyway, help, as always is appreciated.
 
D

doco

A better way I suppose would be to

Private Sub Form_AfterUpdate()
Dim vEntry As Variant

vEntry = Me.SomeField
' return this however your needs are
MsgBox TypeName(vEntry)

End Sub

This will return the subtype being used within the Variant
What I gave before will allways return String. If you used something like
TypeName(Me.SomeField) "TextBox" would return.

doco

doco said:
Use

TypeName(Me.SomeField.Text)

doco
Bill Mitchell said:
Hi,

Is there a function that will return the Data Type for a field in a
Table?

It would be great if I could set my Query RowsourceType to "Fields" and
after update, would generate the Data Type for the field chosen. Anyone
know
this one?

I tried VarType() but I don't think that was it. Maybe I need to create
a
Recordset and then do VartType(rst![MyField)), something like that?

Anyway, help, as always is appreciated.
 
G

Guest

Thanks,

But I'm looking for the Data Type from the underlying table, not the Control
Type on the form.

Bill

doco said:
Use

TypeName(Me.SomeField.Text)

doco
Bill Mitchell said:
Hi,

Is there a function that will return the Data Type for a field in a Table?

It would be great if I could set my Query RowsourceType to "Fields" and
after update, would generate the Data Type for the field chosen. Anyone
know
this one?

I tried VarType() but I don't think that was it. Maybe I need to create a
Recordset and then do VartType(rst![MyField)), something like that?

Anyway, help, as always is appreciated.
 
G

G. Vaught

How about Tools | Analyze | Documenter This will give you the datatype of
all fields in the table.

Bill Mitchell said:
Thanks,

But I'm looking for the Data Type from the underlying table, not the
Control
Type on the form.

Bill

doco said:
Use

TypeName(Me.SomeField.Text)

doco
Bill Mitchell said:
Hi,

Is there a function that will return the Data Type for a field in a
Table?

It would be great if I could set my Query RowsourceType to "Fields" and
after update, would generate the Data Type for the field chosen.
Anyone
know
this one?

I tried VarType() but I don't think that was it. Maybe I need to
create a
Recordset and then do VartType(rst![MyField)), something like that?

Anyway, help, as always is appreciated.
 
A

Allen Browne

And, if you want to do it with code, see:
http://members.iinet.net.au/~allenbrowne/func-06.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

G. Vaught said:
How about Tools | Analyze | Documenter This will give you the datatype of
all fields in the table.

Bill Mitchell said:
Thanks,

But I'm looking for the Data Type from the underlying table, not the
Control
Type on the form.

Bill

doco said:
Use

TypeName(Me.SomeField.Text)

doco
message
Hi,

Is there a function that will return the Data Type for a field in a
Table?

It would be great if I could set my Query RowsourceType to "Fields"
and
after update, would generate the Data Type for the field chosen.
Anyone
know
this one?

I tried VarType() but I don't think that was it. Maybe I need to
create a
Recordset and then do VartType(rst![MyField)), something like that?

Anyway, help, as always is appreciated.
 

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