简体   繁体   中英

Opening Access Report from Excel goes to the 'save as' window

I want to open an Access report from Excel but instead of showing the report it goes to the 'save as' window.

I tried acViewDesign, acViewNormal, acViewPreview and without one as well but it all gives me the same thing.

Dim accessApp As Object


Sub DisplayReport()

Dim DocName As String
Dim Path As String

Set accessApp = CreateObject("Access.Application")

Path = "C:\Users\user\Desktop\Database1.accdb"

accessApp.OpenCurrentDatabase Path

accessApp.DoCmd.OpenReport "Sheet1", acViewReport
accessApp.Visible = True

End Sub

Either add reference to the the Access Object Library or use the value 5 in place of acViewReport

accessApp.DoCmd.OpenReport "Sheet1", 5

All the constant values are here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM