Hallo,
ntoni nsimba wrote:
> ich möchte frage per VBA ob eine Access Tabelle existiert wenn Ja
> Dann diese Tabelle löschen.
> wie kann ich diese Code realisieren ?
Mit so einer Funktion:
Public Function FieldExists(strTable As String, strField As String) _
As Boolean
Dim Db As DAO.Database
Dim Tdf As DAO.TableDef
Dim Fld As DAO.Field
FieldExists = False
Set Db = CurrentDb
Set Tdf = Db.TableDefs(strTable)
For Each Fld In Tdf.Fields
If Fld.Name = strField Then
FieldExists = True
Exit For
End If
Next Fld
Set Fld = Nothing
Set Tdf = Nothing
Set Db = Nothing
End Function
(Luftcode)
Fehlerbehandlung musst du noch einbauen, speziell, wenn die Tabelle nicht
gefunden werden kann.
Gruss - Peter
--
Mitglied im
http://www.dbdev.org
FAQ:
http://www.donkarl.com