invokeaccessreport.frm
来自「《VB6数据库开发指南》所有的例程的源码」· FRM 代码 · 共 57 行
FRM
57 行
VERSION 5.00
Begin VB.Form frmInvokeAccessReport
Caption = "Invoke Access Report"
ClientHeight = 1560
ClientLeft = 60
ClientTop = 345
ClientWidth = 3615
LinkTopic = "Form1"
ScaleHeight = 1560
ScaleWidth = 3615
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdInvokeReport
Caption = "&Invoke Access Report"
Height = 735
Left = 240
TabIndex = 0
Top = 360
Width = 2055
End
End
Attribute VB_Name = "frmInvokeAccessReport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdInvokeReport_Click()
' Invokes an Access report in print preview mode
' Get the ActiveX object to open its database and position
' to the first record
Dim strDbName As String
Dim objAccess As Object
On Error GoTo LoadError
strDbName = App.Path
strDbName = strDbName & "\Expense.mdb"
Set objAccess = CreateObject("Access.Application")
With objAccess
.OpenCurrentDatabase FilePath:=strDbName
.DoCmd.OpenReport ReportName:="ExpenseReport", View:=Access.acPreview
End With
' Give up CPU control
DoEvents
Set objAccess = Nothing
Exit Sub
LoadError:
MsgBox Err.Description & Chr(13) & "from " & Err.Source & " -- Number: " & CStr(Err.Number)
Unload Me
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?