Hi there i was wondring if it is possible to use some VB code to access the caption of a field in a MDB...
It is possible to get the name of the field but i am not sure how to get the caption...
Any ideas?
Rohan
Printable View
Hi there i was wondring if it is possible to use some VB code to access the caption of a field in a MDB...
It is possible to get the name of the field but i am not sure how to get the caption...
Any ideas?
Rohan
To access non-DAO properties of objects, you need to reference the object's Properties collection, and specify the property you want, such as Caption, Description, etc.
To satisfy your question, here's an example that will iterate through a table and print its field names along with their Captions:
Code:Dim dbs As Database
Dim rst As Recordset
Dim fld As Field
Set dbs = OpenDatabase("C:\Whatever\MyData.mdb")
Set rst = dbs.OpenRecordset("MyTable")
Debug.Print "Field Name", "Caption"
For Each fld In rst.Fields
Debug.Print fld.Name, fld.Properties("Caption")
Next