Noname > 26-08-10, 08:27 PM
Function DoesFieldExist (tableName As String, fieldName As String) As Boolean
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim i As Integer
Set db = CurrentDb
Set tdf = db.TableDefs(tableName)
For i = 0 To tdf.Fields.Count - 1
If fieldName = tdf.Fields(i).Name Then
DoesFieldExist = True
Exit Function
End If
Next
End Function
If DoesFieldExist("tblHoso","KiemTra") then
Msgbox " Co Field ton tai trong table"
Else
Msgbox " khong co field ton tai trong table"
End If