Detecting MEMO field

L

Lorenzo Bolognini

Hi all,

i'd like to know if there is some way to detect whether a field is of type
MEMO (i'm using MS Access) so to behave accordingly placing a textarea
instead of a textbox in the UI.

Thank You,
Lorenzo
 
P

PB4FUN

Assuming your Recorset is calle RS and you want to detect the first field
use this :

FS = RS.Fields(0).DefinedSize

For a normal string value you will get a max of 255, where you have a larger
value for a memo field (536870910)

So after that you do this :

If FS < 256 THEN
'Code for textbox"
ELSE IF FS > 500000000 THEN
'code for textarea
END IF

Meindert, MCP
 
B

Bob Barrows

Lorenzo said:
Hi all,

i'd like to know if there is some way to detect whether a field is of
type MEMO (i'm using MS Access) so to behave accordingly placing a
textarea instead of a textbox in the UI.

Thank You,
Lorenzo

The best way is to check the Field's Type property. If you go here:
http://www.able-consulting.com/ADODataTypeEnum.htm, you will see the data
mappings between the ADO datatype constants and the corresponding native
datatypes for a few databases (including Access). So, if the Field's Type
property contains 201 (adLongVarChar) or 203 (adLongVarWChar), then it's a
Memo field.

Bob Barrows
 

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

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top