M
Mr. JYC
Hello,
How can one determine the data type of a field programmatically?
How can one determine the data type of a field programmatically?
Allen Browne said:In what context?
If this is in a form, examine the ControlSource of the text box to get the
field name. Then examine:
Me.Recordset.Fields("SomeFieldName").Type
The result will be one of the dbDataTypeEnum constants. To convert it to
English text, see the FieldTypeName() function here:
http://allenbrowne.com/func-06.html
If you need to read the data type of the field directly from the table, the
TableInfo() function in the link above will do that.
Allen Browne said:In what context?
If this is in a form, examine the ControlSource of the text box to get the
field name. Then examine:
Me.Recordset.Fields("SomeFieldName").Type
The result will be one of the dbDataTypeEnum constants. To convert it to
English text, see the FieldTypeName() function here:
http://allenbrowne.com/func-06.html
If you need to read the data type of the field directly from the table, the
TableInfo() function in the link above will do that.
Mr. JYC said:Come to think of it, how do you programatically determine the data type of
a
variable that may contain any one of the data types supported in Access?