'判定一個字段是否在表中
FunctionBlnFIEld(sTblNameAsString,sFldNameAsString)AsBoolean
'sTblName 源表名
'要查找的字段名
DimfldAsFIEld
DimrsAsDAO.Recordset
BlnFIEld=False
Setrs=CurrentDb.OpenRecordset(sTblName)
rs.FIElds.Refresh
ForEachfldInrs.FIElds
Iffld.Name=sFldNameThen
BlnFIEld=True
ExitFor
EndIf
Next
rs.Close
Setrs=Nothing
Setfld=Nothing
EndFunction
PrivateSub命令0_Click()
'返回True則有此字段,False則無
MsgBoxBlnFIEld("tbl1","ID")
EndSub