CurrentView 屬性

此頁沒有內容條目
內容

expandtri全部顯示

blueup應用于 AccessObject 對象的 CurrentView 屬性。

返回指定的 Microsoft Access 對象的當前視圖。AcCurrentView 只讀。

AcCurrentView 可以是下列 AcCurrentView 常量之一:

acCurViewDatasheet

acCurViewDesign

acCurViewFormBrowse

acCurViewPivotChart

acCurViewPivotTable

acCurViewPreview

expression.CurrentView

expression     必需。返回一個 AccessObject 對象的表達式。

blueup應用于 DataAccessPage 對象的 CurrentView 屬性。

使用 CurrentView 屬性可以確定數據訪問頁的當前顯示方式。Integer 型,只讀。

expression.CurrentView

expression     必需。返回一個 DataAccessPage 對象的表達式。

blueup應用于 Form 對象的 CurrentView 屬性。

使用 CurrentView 屬性可以確定窗體的當前顯示方式。Integer 型,可讀寫。

expression.CurrentView

expression     必需。返回一個 Form 對象的表達式。

設置

CurrentView 屬性使用以下設置:

設置

窗體顯示位置:

數據訪問頁顯示位置:

0

“設計”視圖

“設計”視圖

1

“窗體”視圖

“頁”視圖

2

“數據表”視圖

不可用

 

注釋  該屬性僅在使用Visual Basic 時才可用,且在所有視圖中均為只讀。

說明

使用該屬性可以根據當前視圖的不同而執(zhí)行不同的操作。例如,事件過程可以確定窗體正以哪種視圖顯示,并且在“窗體”視圖中顯示可以執(zhí)行某一操作,在“數據表”視圖中顯示則可執(zhí)行另一操作。

示例

下面的示例使用 GetCurrentView 子程序來決定窗體是在“窗體”視圖還是在“數據表”視圖中。如果在“窗體”視圖中,則在窗體上的文本框中向用戶顯示一條消息;如果在“數據表”視圖中,則在消息框中顯示同一消息。

GetCurrentView Me, "Please contact system administrator."

Sub GetCurrentView(frm As Form, strDisplayMsg As String)

    Const conFormView = 1

    Const conDataSheet = 2

    Dim intView As Integer

    intView = frm.CurrentView

    Select Case intView

        Case conFormView

            frm!MessageTextBox.SetFocus

            ' Display message in text box.

            frm!MessageTextBox = strDisplayMsg

        Case conDataSheet

            ' Display message in message box.

            MsgBox strDisplayMsg

    End Select

End Sub