Addind Caption vallue to field in backend table

G

Gibson

Using the code below I am trying to add a field to a the backend table and
include a caption for the new field. The code creates the field fine but I
receive the error Item Not Found in Collection when I try to set the prop
value. Thanks for any suggestions.

Dim prop As Property
Set dbsData = OpenDatabase("C:\Program Files\BackEnd.MDB")
Set tdfNew = dbsData.TableDefs("flkpTable1")
With tdfNew
.Fields.Append .CreateField("TestField", dbText, 5)
Set prop = .Fields(TestField).CreateProperty("caption", dbText, "Test")
.Fields(TestField).Properties.Append prop
.Fields.Refresh
End With
 

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