我是Access VBA的新手,我有一个tbl_MainData来保存所有数据,frm_main输入数据和一个报告rpt_mainform,我在frm_main上有一个按钮来保存和发送电子邮件但是我不能让它发挥作用。
谢谢
On Error GoTo ErrorHandler
Dim myCurrentDir As String
Dim myReportOutput As String
Dim myMessage As String
myCurrentDir = CurrentProject.Path & "\"
myReportDir = myCurrentDir & "Reports" & "\"
myReportOutput = myReportDir & "Name you desire" & ".pdf"
DoCmd.OutputTo acOutputReport, "Frm_main", _
acFormatPDF, myReportOutput, , , , acExportQualityPrint
myMessage = "Report generated" & myReportDir
MsgBox myMessage, vbInformation
Done:
Exit Sub
ErrorHandler:
MsgBox Error$
Resume Done