可以使用 DBEngine 屬性在 Visual Basic 中訪問(wèn)當(dāng)前的 DBEngine 對(duì)象及其相關(guān)屬性。
expression 必需。返回“應(yīng)用于”列表中的一個(gè)對(duì)象的表達(dá)式。
DBEngine 由 Microsoft Access 設(shè)置,且在所有視圖中都是只讀的。
Application 對(duì)象的 DBEngine 代表 Microsoft Jet 數(shù)據(jù)庫(kù)引擎。DBEngine 對(duì)象是 Data Access Objects (DAO) 模型中的頂層對(duì)象,它包含并控制 Data Access Objects 結(jié)構(gòu)中的所有對(duì)象。
以下示例在消息框中顯示 DBEngine 屬性。
Private Sub Command1_Click()
DisplayApplicationInfo Me
End Sub
Function DisplayApplicationInfo(obj As Object) As Integer
Dim objApp As Object, intI As Integer, strProps As String
On Error Resume Next
' Form Application property.
Set objApp = obj.Application
MsgBox "Application Visible property = " & objApp.Visible
If objApp.UserControl = True Then
For intI = 0 To objApp.DBEngine.Properties.Count - 1
strProps = strProps & objApp.DBEngine.Properties(intI).Name & ", "
Next intI
End If
MsgBox Left(strProps, Len(strProps) - 2) & ".", vbOK, "DBEngine Properties"
End Function