Pulling Caption Value

G

Guest

Is there any way to pull the value of a fields caption property via the
tabledefs object? I.e. from the source table? I am trying the following
code, but getting a 'data member not found' error:

Currentdb.Tabledefs(5).Field(2).caption

Thanks

DEI
 
G

Guest

currentdb.TableDefs(5).Fields(2).properties("caption").Value

If there is no caption, you will get error 3270
 
V

vic

Caption is not a valid property within the Access TableDef object.

While in the VBA editor, press "F2" (or menu View/Object Browser) and
enter "tabledef" in the second combo box (1st box has "<All
Libraries>", 2nd box is blank), and press enter. The second line down
will be for DAO, TableDef. Click this line and in the Classes and
Members of 'TableDef' below, you will see a list of the valid
properties for 'TableDef' Caption is not there.
 
G

Guest

Try the code I posted. It will return the value of the caption if you have
entered a caption for a field in a table. If no caption has been entered, an
error 3270 is returned.
 
M

Marshall Barton

DEI said:
Is there any way to pull the value of a fields caption property via the
tabledefs object? I.e. from the source table? I am trying the following
code, but getting a 'data member not found' error:

Currentdb.Tabledefs(5).Field(2).caption


Currentdb.Tabledefs(5).Fields(2).Properties!Caption

There are quite a few table/field properties that are not
inherent Jet database properties. These nicities are added
by Access as custom properties when you enter something in
the field's properties list. Unfortunately DAO does not
recognize those property names unless you explicitly refer
to the Properties collection.

The other issue with these properties is that they do not
exist if you did not enter something. This means that you
need to use error handling to catch the unknown property
error 3270.
 

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