Question : How do I declare and set variables for the Caption propery of a field in MS Access 2003 Database? (VBA)

How do I declare and set variables for the Caption propery of a field in MS Access 2003 Database? (VBA)

Answer : How do I declare and set variables for the Caption propery of a field in MS Access 2003 Database? (VBA)

use this code, pass the name of the table like this

call getfieldCaption("YourTableName")

Sub getFieldCaption(sTable As String)
On Error Resume Next
Dim tdf As DAO.TableDef, fld As DAO.Field, db As DAO.Database
Set db = CurrentDb
Set tdf = db.TableDefs(sTable)
    For Each fld In tdf.Fields
       If Len(Nz(fld.Properties("Caption"), "")) > 0 Then

          Debug.Print tdf.Name _
             & ", " & fld.Name _
             & ", " & fld.Properties("Caption")
        End If
    Next
End Sub

Random Solutions  
 
programming4us programming4us