DataType from Code A97

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

pietlinden

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
 
S

Stuart McCall

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
 
K

Kahuna

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
 
K

Kahuna

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
 

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