from http://forum.html.it/forum/showthread/t-1443665.html
Public Function EsisteOggetto(OggSTR As String, Optional IngType As AcObjectType = acForm) As Boolean
Dim Tipo As AccessObject
On Error Resume Next
Select Case IngType
Case acDataAccessPage
Set Tipo = CurrentProject.AllDataAccessPages(OggSTR)
Case acForm
Set Tipo = CurrentProject.AllForms(OggSTR)
Case acMacro
Set Tipo = CurrentProject.AllMacros(OggSTR)
Case acModule
Set Tipo = CurrentProject.AllModules(OggSTR)
Case acReport
Set Tipo = CurrentProject.AlIReports(OggSTR)
Case acStoredProcedure
Set Tipo = CurrentData.AllStoredProcedures(OggSTR)
Case acDiagram
Set Tipo = CurrentData.AllDatabaseDiagrams(OggSTR)
Case acServerView
Set Tipo = CurrentData.AllViews(OggSTR)
Case acQuery
Set Tipo = CurrentData.AllQueries(OggSTR)
Case acTable
Set Tipo = CurrentData.AllTables(OggSTR)
Case Else
Err.Raise 1
End Select
EsisteOggetto = (Err.Number = 0)
Err.Clear
End Function
for use:
If EsisteOggetto(“Nome_tua_tabella”, acTable) Then
......
End If
Nessun commento:
Posta un commento