ZjiÜt∞nφ existence pole v tabulce

Funkce:

Public Function FieldExists(DatabaseName As String, TableName As String, FieldName As String) As Boolean

   
'DataBaseName: cesta k souboru
   'tablename: tabulka, fieldname: pole
   'Pokud DB nebo tabulka neexistuje, vyvolß chybu

   Dim oDB As Database
   Dim td As TableDef
   Dim f As Field

   On Error GoTo errorhandler

   Set oDB = Workspaces(0).OpenDatabase(DatabaseName)
   Set td = oDB.TableDefs(TableName)

   On Error Resume Next
   Set f = td.Fields(FieldName)
   FieldExists = Err.Number = 0
   oDB.Close

   Exit Function

errorhandler:

   If Not oDB Is Nothing Then oDB.Close
   Err.Raise Err.Number
   Exit Function

End Function

Zp∞t

Autor: The Bozena