Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View an Access Report using a button 1

Status
Not open for further replies.

merlynsdad

Programmer
Nov 18, 2010
175
US
I have a report that needs to be viewed as well as printed. I have a button that prints it, and a button that views it. The coding on the VIEW button is simply
Code:
DoCmd.OpenReport "rptOpenTickets", acViewPreview
This doesn't work, however, because the Access framework is not up when the button is pressed. I don't want the framework up, but I still need to be able to have people view the report, rather than print it. What's the best way to do this?

If the square peg won't fit in the round hole, sand off the corners.
 
If that's 3 commas, as in
Code:
DoCmd.OpenReport "rptOpenTickets", acViewPreview , , , acDialog
it froze the program.
The only thing showing is a form. On the form is a button, and the above line of code is the only code in the click event for that button. Now if I'm working in the Access environment, it works just fine, but then so does my original code.

If the square peg won't fit in the round hole, sand off the corners.
 
I guess I missed the "Access framework" or didn't understand what you meant. I think you need to provide the details of the environment if you expect a good answer.

Duane
Hook'D on Access
MS Access MVP
 
The Access environment is not showing; the only thing up is a form. The form has a button that prints a report. What I want to do is add another button to view the report AS PRINTED, so the user doesn't have to print it every time he wants to see it. The owner/user of this portion of the db doesn't know Access that well, so I'd rather keep him from having to open Access to do a print preview. I've looked online, and seen several add-ins that will do this, but I can't use an add-in. How do I code that VIEW button so he can do this?

If the square peg won't fit in the round hole, sand off the corners.
 
I figured it out. I'm following the guidelines in faq705-2562 "Hide the Access Window" to hide the environment. When I started this project there were no reports, so I ignored Step 5. When I added reports, I forgot the guidelines I'd used to hide the environment. Asking me how I hid it triggered a thought, and I went back to the guidelines and discovered Step 5. I implemented it, and the user can now preview the report from a button.

If the square peg won't fit in the round hole, sand off the corners.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top