How do I open my report in print preview mode in Access?

S

SwMC

I am using Access 2007. I have my report opening in print preview mode when
I open it from the navigation bar. When I open it from the switchboard it
opens in report view. How can I get it to open in print preview from the
switchboard?
 
D

Dennis

SwMC,

I am using Access 2007. I have my report opening in print preview mode when
I open it from the navigation bar. When I open it from the switchboard it
opens in report view. How can I get it to open in print preview from the
switchboard?


I don't know much about switchboard, but here is the VBA code I use to open
reports in preview mode:

Start Code -----------------------------------

DoCmd.OpenReport strDocName, acViewPreview, , strWhere, acWindowNormal,
strOpenArgs

End code ----------------------------------------

Where:
- strDocName is the variables that contains your report name
- acViewPreview is an Access Constants that tells Access to open in preview
mode. (just type it as it appears)
- strWhere - is a variable that contains a SQL WHERE clause witihout the
word "WHERE" - if you do not have a filter, then just leave this parm blank,
- acWindowNormal - tells Access to open a normal window - this is an Access
constant
strOpenArgs - if you have opening arguments you want to pass to the report,
put them in this variable. If not, leave this parm blank.

I think this answers you question, but I'm not sure.

Dennis
 
F

fredg

I am using Access 2007. I have my report opening in print preview mode when
I open it from the navigation bar. When I open it from the switchboard it
opens in report view. How can I get it to open in print preview from the
switchboard?

Display the VBA code window for the Switchboard form.

Find the Private Function HandleButtonClick(intBtn As Integer)
function in the code.
Drop down a bit further to the Select Case rst![Command] section of
the function.
Change the conCmdOpenReport so it looks like this:

Case conCmdOpenReport
DoCmd.OpenReport rst![Argument], acPreview

Save the changes. Done.
 
Joined
Jun 6, 2012
Messages
1
Reaction score
0
I just ran into this problem as well. Since I didn't see an easy solution i thought I would post mine. I solved it by writing a Macro to open the report in print preview mode and the running the macro from the switchboard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top