Here is the code I have used in the past:
Function FieldExists(strField as string, varIn as Variant) as Boolean
on error resume next
Dim fld as DAO.Field
FieldExists=False
for each fld in varIn.Fields
if fld.name=strfield then
FieldExists=True
end if
next fld
End Function.
I'm writing it freehand, so excuse any mistakes please! The function takes a field name and a variant as parameters. The variant could be a tabledef, a recordset or a querydef.
Dim td as tabledef
set td=currentdb.tabledefs("tblData"
msgbox Fieldexists("Field1",td)
HTH
Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------