Public Function FieldsSearh(TblName As String, fldname As String) As Boolean
Dim rst As DAO.Recordset
Dim fld As Field
On Error GoTo ErrFs
Set rst = CurrentDb.OpenRecordset("SELECT * FROM " & TblName & ";")
For Each fld In rst.Fields
If fld.Name = fldname Then
FieldsSearh = True
Set rst=Nothing
Exit Function
End If
Next
FieldsSearh = False
Set rst=Nothing
Exit Function
ErrFs:
MsgBox Err.Number & Err.Description, vbCritical, "Ошибка"
End Function
Public Sub tst()
Debug.Print FieldsSearh("Tbl1", "Id1")
End Sub
|