Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Caption property of table field

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
I'm using the following code to create a field in a backend database named BackEnd.mdb. I can't seem to find a way to add a caption into the Caption property of the new field. It doesn't seem to be an attribute that can be added via the CreateField method though I'm sure I missed something.
Can someone point me in the right direction? Thanks

Set dbsData = OpenDatabase("C:\Program Files\TSRWIN\TSRDATA.MDB")
'Set tdfNew = dbsData.OpenRecordset("C:\Program Files\BackEnd.MDB")

Set tdfNew = dbsData.TableDefs("Table1")

With tdfNew
.Fields.Append .CreateField("Field1", dbText, 5)
End With
 
like this

rst.Fields(1).Properties("caption")
 
post I did was not very helpful. Here is a better example

Code:
Dim dbs As Database, tdf As TableDef, prop As Property
   
Set dbs = CurrentDb
    Set tdf = dbs.TableDefs!table1
    Set prop = tdf.Fields(1).CreateProperty("caption", dbText, "Hello World")
    tdf.Fields(1).Properties.Append prop
    tdf.Fields.Refresh
    Set dbs = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top