Greetings,
I have the code below (in VB 6.0) and am attempting to open an existing report (in Access 2000) in Print Preview mode. However, I receive the following error when it gets to the line of code, "acapp.DoCmd.OpenReport ...":
"Runtime error 2486: You can't carry out this action at the present time."
As far as I can tell, I have the necessary references checked. Any idea as to why this is happening?
Thanks in advance!
hsp7777
Code:
Dim acapp As Object
Dim db As DAO.Database
Dim strDateText As String
Dim strReportName As String
Dim wrkjet As DAO.Workspace
strReportName = "rptPrintTasks"
Set wrkjet = CreateWorkspace("", "admin", "", dbUseJet)
Set acapp = CreateObject("Access.Application")
acapp.Visible = True
Set db = wrkjet.OpenDatabase("C:Sample2.mdb", True)
acapp.DoCmd.OpenReport reportname:=strReportName,
View:=acViewPreview (Code fails here)
End Sub
I have the code below (in VB 6.0) and am attempting to open an existing report (in Access 2000) in Print Preview mode. However, I receive the following error when it gets to the line of code, "acapp.DoCmd.OpenReport ...":
"Runtime error 2486: You can't carry out this action at the present time."
As far as I can tell, I have the necessary references checked. Any idea as to why this is happening?
Thanks in advance!
hsp7777
Code:
Dim acapp As Object
Dim db As DAO.Database
Dim strDateText As String
Dim strReportName As String
Dim wrkjet As DAO.Workspace
strReportName = "rptPrintTasks"
Set wrkjet = CreateWorkspace("", "admin", "", dbUseJet)
Set acapp = CreateObject("Access.Application")
acapp.Visible = True
Set db = wrkjet.OpenDatabase("C:Sample2.mdb", True)
acapp.DoCmd.OpenReport reportname:=strReportName,
View:=acViewPreview (Code fails here)
End Sub