View Full Version : A very simple report question


dmatt
03-18-2010, 03:54 PM
Hi all,

I have never posted on these forums, but it seems that most requests here get answered in earnest by some very helpful people, so I decided to post my own (embarrassingly easy) challenge.

Basically, I'd like to view a report by clicking a button on my database switchboard. The default DoCmd.OpenReport command prints the report to a pdf, but what I'd really like to do is just view the report in "report view" within access.

I have tried poking around at various solutions, and the best I found was writing some language like this:

DoCmd.OpenReport "Outstanding_offers",acViewPreview,,,acWindowNormal,

Which doesn't work. I think my main problem is that I don't have anything entered for the [OpenArg] input for the expression, but I'm not sure. Anyway, I don't want to specify any criteria for opening the report - it is set up exactly how I'd like to view it every time - so I really don't know what to enter for that last argument in the expression.

Can any of you kind access experts assist me here?

Best,

Darren

P.S. Not sure if this post should have gone in the VBA section - my apologies if it should have.

vbaInet
03-18-2010, 04:02 PM
Welcome to AWF Darren :)

This sounds like a database you acquired?

dmatt
03-18-2010, 04:18 PM
I wish! No, I have basically constructed what was - at first - a really simple database, but which is now becoming a bit more complex. I used the "Access 2007 Bible" book to build the skeletal structure, relationships and form functionalities, but when it comes to VBA I'm almost completely at a loss. Any suggested sources for familiarizing myself with it?

vbaInet
03-18-2010, 04:44 PM
It's a weird situation if all you're getting is just pdfs. Few questions:

1. Have you got the full version of Access 2007?
2. Is there a Docmd.OutputTo statement in any part of your code within the whole database?
3. What happens when you double-click the report to open it without using the switchboard?

dmatt
03-19-2010, 05:47 AM
1) Yes, I have the full version
2) No
3) When I double click the report it opens in report view, which is exactly how I would like clicking the button to lead me to viewing it. :confused:

vbaInet
03-19-2010, 05:52 AM
Can you show me a screenshot of the report when opened via the button?

dmatt
03-19-2010, 06:58 AM
Aha! Nevermind, I fixed it. Thanks for your help anyway!

Basically, the solution was to write the following in the VBA:
_________

Private Sub Command17_Click()

DoCmd.OpenReport "Offers_outstanding", acViewReport


End Sub

__________

And that did it.

Best,

Darren

vbaInet
03-19-2010, 07:03 AM
Great! Glad you got that sorted.

Khalid_Afridi
03-19-2010, 07:04 AM
Hi all,



DoCmd.OpenReport "Outstanding_offers",acViewPreview,,,acWindowNormal,

Which doesn't work.



Try this:
DoCmd.OpenReport "Outstanding_offers", acPreview

Khalid