Creating an 'Hypertext' field

P

philip

It's easy to create a field in a table by vba :
So :
Tdf.CreateField("Field1", dbText, 25)
create a text field of 25 characters long.

But which constant may I use to create an 'hypertext' field ?
Thanks for solution if someone has.
 
A

Allen Browne

You cannot create a Hyperlink field with DDL.

A Hyperlink field in JET is actually a Memo field with Attributes set so it
is treated specially. You can create the field with DAO, using
CreateField(), a field type of dbMemo, and set the Attributes. (If you
prefer use ADOX to add a column of type adLongVarWChar, and set the
Attributes.)

Creating fields with DDL does not work well in JET. For any Text of Memo
field, you *really* need to be able to set the AllowZeroLength property to
No to prevent bad data. DDL does not let you set this basic property, and
the actual default setting varies depending on how you create the field and
what version of Access you are using, so creating tables or fields with DDL
is not practical in Access.

If you are trying to compare the names used for the JET field types in the
interface, DDL, DAO, and ADOX, see:
Field type names
at:
http://allenbrowne.com/ser-49.html
 
P

philip

I just seen your response. Thanks sincerely



Allen Browne said:
You cannot create a Hyperlink field with DDL.

A Hyperlink field in JET is actually a Memo field with Attributes set so
it is treated specially. You can create the field with DAO, using
CreateField(), a field type of dbMemo, and set the Attributes. (If you
prefer use ADOX to add a column of type adLongVarWChar, and set the
Attributes.)

Creating fields with DDL does not work well in JET. For any Text of Memo
field, you *really* need to be able to set the AllowZeroLength property to
No to prevent bad data. DDL does not let you set this basic property, and
the actual default setting varies depending on how you create the field
and what version of Access you are using, so creating tables or fields
with DDL is not practical in Access.

If you are trying to compare the names used for the JET field types in the
interface, DDL, DAO, and ADOX, see:
Field type names
at:
http://allenbrowne.com/ser-49.html
 

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