
Referencing Field Properties InputMask and Format, using VB/VBA
You will get an error if you try to reference these properties for a
field that hasn't had any values assigned to them. But since you are
only interested in the ones that do have values, you can safely ignore
those errors. Something like this:
Public Sub GetProps()
On Error GoTo Handle_Err
Dim db As Database
Dim tdf As TableDef
Dim fld As Field
Set db = CurrentDb
For Each tdf In db.TableDefs
For Each fld In tdf.Fields
Debug.Print tdf.Name, fld.Name, _
"Format:" & fld.Properties("Format")
Debug.Print tdf.Name, fld.Name, _
"InputMask:" & fld.Properties("InputMask")
Next fld
Next tdf
Exit_Here:
Exit Sub
Handle_Err:
Select Case Err.Number
Case 3270 'Property Not Found
Resume Next
Case Else
MsgBox Err.Number & _
vbCrLf & Err.Description, , "Error"
End Select
Resume Exit_Here
End Sub
-- Andy
Quote:
>Hi
>I am trying to document an Access database using some VB/VBA code and nwish
>to output to a text file the Input Mask (and Format) properties of the
>field.
>I am interating the TableDefs and Fields collection to get to the various
>objects properties, but cannot reference the InputMask and Format
>properties.
>Does anyone know how this can be achieved?
>TIA
>Consultant/Developer