Access 2003
The code below did not print out the name of the fields
in the table. The For Each was never executed.
///////////////////////////////////////////
Sub Determine_If_A_Field_Exist()
Dim Dbs As Database
Dim Table_Definition As TableDef
Dim fldLoop As Field
Set Dbs = CurrentDb
Set Table_Definition = Dbs.CreateTableDef("CrossTab")
Debug.Print "Properties of new Fields in " &
Table_Definition.Name
' Enumerate Fields collection to show the properties of
' the new Field objects.
For Each fldLoop In Table_Definition.Fields
Debug.Print " " & Table_Definition.Name
If Table_Definition![LV_1] = True Then
MsgBox "The field exist"
End If
Next fldLoop
Dbs.Close
End Sub
The code below did not print out the name of the fields
in the table. The For Each was never executed.
///////////////////////////////////////////
Sub Determine_If_A_Field_Exist()
Dim Dbs As Database
Dim Table_Definition As TableDef
Dim fldLoop As Field
Set Dbs = CurrentDb
Set Table_Definition = Dbs.CreateTableDef("CrossTab")
Debug.Print "Properties of new Fields in " &
Table_Definition.Name
' Enumerate Fields collection to show the properties of
' the new Field objects.
For Each fldLoop In Table_Definition.Fields
Debug.Print " " & Table_Definition.Name
If Table_Definition![LV_1] = True Then
MsgBox "The field exist"
End If
Next fldLoop
Dbs.Close
End Sub