This example uses the Required property to report which fields in three different tables must contain data in order for a new record to be added. The RequiredOutput procedure is required for this procedure to run.
Sub RequiredX()
Dim dbsNorthwind As Database
Dim tdfloop As TableDef
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
With dbsNorthwind
' Show which fields are required in the Fields
' collections of three different TableDef objects.
RequiredOutput .TableDefs("Categories")
RequiredOutput .TableDefs("Customers")
RequiredOutput .TableDefs("Employees")
.Close
End With
End Sub
Sub RequiredOutput(tdfTemp As TableDef)
Dim fldLoop As Field
' Enumerate Fields collection of the specified TableDef
' and show the Required property.
Debug.Print "Fields in " & tdfTemp.Name & ":"
For Each fldLoop In tdfTemp.Fields
Debug.Print , fldLoop.Name & ", Required = " & _
fldLoop.Required
Next fldLoop
End Sub