[AccessD] Setting the Caption property for a table field

Brett Barabash BBarabash at TappeConstruction.com
Mon Feb 10 13:37:23 CST 2003


I am totally going off the top of my head here, but...

As Chris said, a Caption property is not created automatically with the
field.  It needs to be created and appended to the field's properties
collection.  Code to do this looks something like:

Dim db As DAO.Database
Dim fld As DAO.Field
Dim prp As DAO.Property

Set db = CurrentDB()
Set fld = db.TableDefs("tblMyTable").Fields("CustomerName")

Set prp = fld.CreateProperty("Caption")
prp.Value = "Customer Name"
fld.Properties.Append prp
fld.Properties.Refresh

Set prp = Nothing
Set fld = Nothing
Set db = Nothing

Of course, in the real world you would also have to handle a situation where
someone has already defined a Caption.


-----Original Message-----
From: Chris Mackin [mailto:chris at denverdb.com]
Sent: Monday, February 10, 2003 1:21 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Setting the Caption property for a table field


The key is that the Caption property doesn't exist until it's created, so
you can't just set the property, create it first.

Chris Mackin
Denver Database Consulting, LLC
www.denverdb.com


-----Original Message-----
From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com]On Behalf Of John Skolits
Sent: Monday, February 10, 2003 12:05 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Setting the Caption property for a table field


Anyone know how to set the "Caption" property of a table field in code?

I'm thinking this is a dumb question but maybe it's not.

John Skolits


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list