Public Function esiste_tabella(nome_tab As String, _
Optional nome_dbs) As Boolean
'Autore: Lbo
'Accetta:
' nome_tab = nome della tabella da cercare
' nome_dbs = [Opz.] percorso+nome del database in cui cercare
'Restituisce: true se la tabella esiste
Dim dbs As Database
Dim tdf As TableDef
If IsMissing(nome_dbs) Then
nome_dbs = CurrentDb.Name
End If
Set dbs = DBEngine.Workspaces(0).Databases(nome_dbs)
For Each tdf In dbs.TableDefs
If tdf.Name = nome_tab Then
esiste_tabella = True
Exit Function
End If
Next tdf
esiste_tabella = False
End Function
|