DefaultWorkspaceClone 方法

此頁沒有內(nèi)容條目
內(nèi)容

expandtri全部顯示

當在 Visual Basic 中設(shè)置了 AppTitleAppIcon 屬性后,RefreshTitleBar 方法可以刷新 Microsoft Access 標題欄

expression.RefreshTitleBar

expression    必需。返回“應(yīng)用于”列表中的一個對象的表達式。

說明

例如,在 Microsoft Access 標題欄中可以通過設(shè)置 AppTitle 屬性將標題更改為“聯(lián)系人數(shù)據(jù)庫”。

AppTitleAppIcon 屬性使用戶可以通過更改 Microsoft Access 標題欄中顯示的標題和圖標來自定義應(yīng)用程序。設(shè)置這些屬性后標題欄并不會自動更新,如果要顯示對標題欄的更改,必須使用 RefreshTitleBar 方法。

注釋  在 Microsoft Access 數(shù)據(jù)庫 (.mdb) 中,可以將 AppTitleAppIcon 屬性重置為默認值,方法是:從代表當前數(shù)據(jù)庫的 Properties 集合內(nèi)將其刪除。刪除這些屬性之后,必須使用 RefreshTitleBar 方法恢復(fù) Microsoft Access 標題欄的默認設(shè)置。

如果 AppIcon 屬性所指定的圖標路徑無效,則調(diào)用此方法時,不會有更改反映到標題欄中。

示例

下面的示例設(shè)置當前數(shù)據(jù)庫的 AppTitle 屬性并用 RefreshTitleBar 方法來更新標題欄。

Sub ChangeTitle()

    Dim obj As Object

    Const conPropNotFoundError = 3270

    On Error GoTo ErrorHandler

    ' Return Database object variable pointing to

    ' the current database.

    Set dbs = CurrentDb

    ' Change title bar.

    dbs.Properties!AppTitle = "Contacts Database"

    ' Update title bar on screen.

    Application.RefreshTitleBar

    Exit Sub

ErrorHandler:

    If Err.Number = conPropNotFoundError Then

        Set obj = dbs.CreateProperty("AppTitle", dbText, "Contacts Database")

        dbs.Properties.Append obj

    Else

        MsgBox "Error: " & Err.Number & vbCrLf & Err.Description

    End If

    Resume Next

End Sub