Public Function FUN_IS_TABLE(Table_Name As String) As Boolean
' Проверка наличия таблицы в базе
Dim adoxCat As Object
Dim adoxTbl As Object
If GLB_Proverka = True Then Call FUN_IN_TXT(FUN_Patch_File(App.Path, "Process_Log.txt"), Now() & " _модуль " & "TABLE_MOD" & " _процедура " & "FUN_IS_TABLE")
'---------------------------------------------------------------------------
On Error GoTo FUN_IS_TABLE_Error
'---------------------------------------------------------------------------
Set adoxCat = CreateObject("ADOX.Catalog")
Set adoxTbl = CreateObject("ADOX.Table")
'или
'adoxCat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.FullName
FUN_IS_TABLE = False
GLB_con.Close
If FUN_Get_GlobalConnection = False Then
FUN_IS_TABLE = False
Exit Function
End If
Set adoxCat.ActiveConnection = GLB_con
For Each adoxTbl In adoxCat.Tables
If adoxTbl.Name = Table_Name Then
FUN_IS_TABLE = True
'MsgBox adoxTbl.Name
Exit Function
Else
End If
Next
Call FUN_IN_TXT(FUN_Patch_File(App.Path, "TEMP_ERROR.log"), "Отсутствует таблица " & Table_Name)
'
Set adoxCat = Nothing
Set adoxTbl = Nothing
'---------------------------------------------------------------------------
On Error GoTo 0
Exit Function
FUN_IS_TABLE_Error:
Error_String = Err.Description: Call FUN_IN_TXT(FUN_Patch_File(App.Path, "Error.txt"), Now() & " _модуль " & "TABLE_MOD" & " _процедура " & "FUN_IS_TABLE" & " ..ошибка." & Error_String)
End Function
|