DataType from Code A97

  • Thread starter Thread starter Kahuna
  • Start date Start date
K

Kahuna

Hi Folks

I need the data type of a field which is the source for a form text box.

Could someone steer me in the right direction.

Do I need to

1. Get the
Source_Field = (me.[field_name].source ???)

2. Get the type for that source Type = Source_Field.DataType ????

Appreciate your feedback.
 
Hi Folks

I need the data type of a field which is the source for a form text box.

Could someone steer me in the right direction.

Do I need to

1. Get the
        Source_Field = (me.[field_name].source ???)

2. Get the type for that source Type = Source_Field.DataType ????

Appreciate your feedback.

If it's from a table, you can get the field and then the field's type
something like this...

Function ReturnFieldType(byval strSrcTable as string, byval
strSrcField as string) as integer
dim tdf as dao.tabledef
dim fld as dao.field

set tdf=DBEngine(0)(0).TableDefs(strSrcTable)
set fld=tdf.Fields(strSrcField)

ReturnFieldType=fld.Type

set fld=Nothing
set tdf=Nothing
End Function
 
Kahuna said:
Hi Folks

I need the data type of a field which is the source for a form text box.

Could someone steer me in the right direction.

Do I need to

1. Get the
Source_Field = (me.[field_name].source ???)

2. Get the type for that source Type = Source_Field.DataType ????

Appreciate your feedback.

This function will get you the data type for any bound control:

http://www.smccall.demon.co.uk/Forms.htm#CtlDataType
 
Thanks Piet
Hi Folks

I need the data type of a field which is the source for a form text box.

Could someone steer me in the right direction.

Do I need to

1. Get the
Source_Field = (me.[field_name].source ???)

2. Get the type for that source Type = Source_Field.DataType ????

Appreciate your feedback.

If it's from a table, you can get the field and then the field's type
something like this...

Function ReturnFieldType(byval strSrcTable as string, byval
strSrcField as string) as integer
dim tdf as dao.tabledef
dim fld as dao.field

set tdf=DBEngine(0)(0).TableDefs(strSrcTable)
set fld=tdf.Fields(strSrcField)

ReturnFieldType=fld.Type

set fld=Nothing
set tdf=Nothing
End Function
 
Exactly what I was looking for thanks Stuart


Stuart McCall said:
Kahuna said:
Hi Folks

I need the data type of a field which is the source for a form text box.

Could someone steer me in the right direction.

Do I need to

1. Get the
Source_Field = (me.[field_name].source ???)

2. Get the type for that source Type = Source_Field.DataType ????

Appreciate your feedback.

This function will get you the data type for any bound control:

http://www.smccall.demon.co.uk/Forms.htm#CtlDataType
 
Back
Top