Setting Table Field Descriptions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can one automatically set the field descriptions of a table in an Access
2003 .mdb database?

Simple enough question, right?
 
While the table's open in Design view, you type the descriptions in the
Description column beside each field.

DId you have something else in mind?
 
Yes, I wish to set the description in code. The vba code I have does some
magic and creates a table for me, but then I want to add in the field
descriptions.

Now, I know that if I can change a description if one exists by using:

CurrentDB.TableDefs![MyTable].Fields![MyField].Properties!Description =
MyDescription

The trouble is that I just created the table as part of the vba code, and
thus I don't have any field descriptions included yet. Apparently, trying
this code won't work because there is, a priori, no "Description" property to
change. (This concept is a bit strange to me, BTW)

Thanks!
 
Take a look at the CreateProperty method in the Help file.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Rob said:
Yes, I wish to set the description in code. The vba code I have does some
magic and creates a table for me, but then I want to add in the field
descriptions.

Now, I know that if I can change a description if one exists by using:

CurrentDB.TableDefs![MyTable].Fields![MyField].Properties!Description =
MyDescription

The trouble is that I just created the table as part of the vba code, and
thus I don't have any field descriptions included yet. Apparently,
trying
this code won't work because there is, a priori, no "Description" property
to
change. (This concept is a bit strange to me, BTW)

Thanks!

Douglas J. Steele said:
While the table's open in Design view, you type the descriptions in the
Description column beside each field.

DId you have something else in mind?
 
Rob said:
The trouble is that I just created the table as part of the vba code, and
thus I don't have any field descriptions included yet. Apparently, trying
this code won't work because there is, a priori, no "Description" property to
change. (This concept is a bit strange to me, BTW)

Dim prp as property
Set prp = tdfField.CreateProperty("Caption", dbText, "Unit #")
tdfField.Properties.Append prp

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
Back
Top