different report views

moose

c'mon Chelsea
Local time
Today, 19:11
Joined
May 18, 2001
Messages
139
i have a 2 page report and when it is opened, it defaults to the single page view, what i want is for it to open in the 2 page view.
is this possible?
 
where would i put this code?
i already have a macro on the open report button
 
Sorry I never use Macros: in code
DoCmd.OpenReport etc
DoCmd.RunCommand acCmdPreviewTwoPages
 
sorry for being ignorant, but what is the etc bit?
i guess its the report name but does it need any punctuation round it?
 
The easiest way provided you're not using criteria is to use the button wizard, it'll create the code for you
 
it might help if i explain what im trying to do.
i have a form with a combobox which is populated by a query.
once the selection is made a command button is clicked which then runs a query and opens a report based on that query.
problem i have is the report opens in single page view instead of two page view
 
Dim stDocName As String

stDocName = "YourReportName"

DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdPreviewTwoPages
 
The code i have is

Private Sub Report_Open(Cancel As Integer)
Dim stDocName As String

stDocName = "concession"

DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdPreviewTwoPages
End Sub

but when it runs i get the error message

Run Time Error '2046'
The command or action 'PreviewTwoPages' isn't available now.

Any suggestions?
 
I've been playing with this and i get the feeling that the code falls over because the report is not the active window.
how do i make the report active just prior to running the previewtwopages event?
 
I have now got it so that when the code runs, it falls over and highlights the
DoCmd.RunCommand acCmdPreviewTwoPages line.

when i go to the debug screen and close it, it says
This action will reset the current code in break mode

If i click yes it opens in the two page preview that i have been looking for, so i just need to get rid of the error and the halt in the code

Can anyone help a frustrated man please?
 

Users who are viewing this thread

Back
Top Bottom