VBA, MS Access MS Access в примерах

Свойства (Properties) - Вывод в Immediate Window списка всех свойств БД

Полезно иногода посмотреть на все свойства "оптом"
Показать Immediate Window: [Ctrl + G]

Public Sub Print_DB_Properties(Optional sPath As String = "")
'es - 15.01.2020
'----------------------------------------------------------------
'Вывод в Immediate Window списка всех свойств (Properties) БД
'--------------------------------------------------------------------
Dim dbs As Database, prp As Property
Dim v As Variant

On Error GoTo Print_DB_Properties_Err

    If sPath <> "" Then
        Set dbs = DAO.OpenDatabase(sPath)
    Else
        Set dbs = CurrentDb
    End If

    Debug.Print "---------------------------------------------------"
    
    For Each prp In dbs.Properties
        v = Null
        On Error Resume Next
        v = prp.Value
        Err.Clear
        Debug.Print prp.Name & " = " & v
    Next
    Debug.Print "---------------------------------------------------"


Print_DB_Properties_End:
    On Error Resume Next
    Set prp = Nothing
    Set dbs = Nothing
    
    Err.Clear
    Exit Sub

Print_DB_Properties_Err:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in Sub Print_DB_Properties.", _
        vbCritical, "Произошла ошибка!"
    Debug.Print "Print_DB_Properties_Line: " & Erl & "."
    Err.Clear
    Resume Print_DB_Properties_End

End Sub

Назад ToTop
L.E. 15.01.2020
Рейтинг@Mail.ru