Function BlnFIEld(sTblName As String, sFldName As String) As Boolean
'sTblName 源表名
'要查找的字段名
Dim fld As FIEld
Dim rs As DAO.Recordset
BlnFIEld = False
Set rs = CurrentDb.OpenRecordset(sTblName)
rs.FIElds.Refresh
For Each fld In rs.FIElds
If fld.Name = sFldName Then
BlnFIEld = True
Exit For
End If
Next
rs.Close
Set rs = Nothing
Set fld = Nothing
End Function
Private Sub 命令0_Click()
'返回True則有此字段,False則無
MsgBox BlnFIEld("tbl1", "ID")
End Sub