PDA

View Full Version : Solved: Setting Caption Property of Table



swoozie
05-24-2006, 10:35 AM
How do you set the CAPTION property of the access table/columns you have created in code/dynamically?

I am not finding any real references on the topic.

I create,then alter the table using:

"ALTER TABLE " & NewTbl & " ADD COLUMN " & FldName & " " & fldType

and I want to modify the caption setting at the same time. :banghead:

Norie
05-24-2006, 12:48 PM
I don't think you'll be able to do that with SQL.

And I'm not sure you'll be able to do it with VBA.

I'll go and test though.

OBP
05-24-2006, 02:07 PM
swoozie & Norie, have a look at Defining Table Definitions in VBA it may have something on the Caption Property.

swoozie
05-25-2006, 08:23 AM
using DAO I was able to use this line of text

Set props = flds.CreateProperty("Caption", dbText, CapName)

Norie
05-25-2006, 09:27 AM
Does that actually change/set the caption on a field/table?

I thought CreateProperty was for creating user-defined properties.

swoozie
05-25-2006, 01:04 PM
That is only the syntax for creating the caption on a table field. It works, I now have captions and when I open the table in design view I have captions. Now if you are changing a caption that would not work, you require a different syntax. I will look it up and provide 2mro