Results 1 to 9 of 9
  1. #1
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727

    Print Dialogue Box


    I have a print button and when you click on it, it shows a print dialogue box with limited features. I was wondering if there was a way to have a dialogue box that has print preview? This way I can see what the printout will look like before I print it.

    Thanks.

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    What's the code behind the button?
    You should be able to specify print preview as a option in the code.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Add code like this to a command button on your form
    Code:
    DoCmd.OpenReport "YourReportName",acViewPreview
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thanks for the reply. I actually have these print buttons on both forms and reports. It sounds like you are suggesting that the report itself, will serve as the print preview? Sorry if I'm wrong but I was looking for a more traditional way of viewing a print preview. Similar to how when you are in MS WORD and you go to File then Print and you get to see a picture of the document before you print it. Is there something like that? Right now, I just get this really limited version of a print dialogue box that has some options but print preview is not one of them. Here is the code behind my print buttons:

    On Error Resume Next
    DoCmd.RunCommand acCmdPrint
    Me.txtTabStopper.SetFocus

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    As well as sending reports direct to the print dialog, reports can be displayed on the screen in several ways:
    a) layout view - allow final adjustments to the report design
    b) report view - allow limited interaction including print buttons BUT doesn't look the same as it will when printed
    c) print preview - displayed exactly as it will be printed - any buttons will not be displayed
    A print preview ribbon is shown:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	22 
Size:	16.4 KB 
ID:	49062

    I usually set print preview as the default option for reports
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #6
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Sorry I guess I should have mentioned that my database is extremely locked up from the user. Basically the ribbon is gone, all the hotkeys or keys that could generally mess things up are locked. Navigation panel on the left is hidden. So basically the only thing the user has in front of them is the form/report. I do this to prevent accidental mistakes from happening and to have good control on the user experience. They have a login with password and even when they save records it has their initials tied to the record from their login and that will let us know who worked on the record. So it really is like a program. With that being said, do you have any other suggestions for that kind of environment?


    Thanks for the help.

  7. #7
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Yes, it would have been a good idea to mention that important point right from the beginning!

    However, I have plenty of experience of doing all that . . . and more
    You can still open reports in print preview in that environment. When the report is closed the ribbon can be hidden again
    Have a look at my article and example app on Controlling the Application Interface
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  8. #8
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Wow that is interesting how you have a dedicated form just for controlling the user interface. I do like that idea but that seems like it will be a bit time consuming for me at the moment. I will keep it in mind for future ideas as I never thought of doing something like that before. Right now I have a splash screen that opens up the login form after a few seconds. It also hides the back window for access where the ribbon would be but that is hidden as well along with the navigation panel to the left. The thing I never really liked was how if the user clicks on the Access program in the taskbar at the bottom of the screen, that will enable for the back window to pop up on screen. So that does get a bit annoying. To remedy that, I created a minimize button on some forms to have the user click on it to make that back window go back down to the taskbar. I'm sure its not the best way to handle it but its been tolerable for now.

    As far as my reports go, I basically do not have print preview options at the top of the report. The ribbon is hidden from the get go when the user generates the report. The only thing I have on the report that the user can interact with are 3 buttons. One is for printing, another for exporting to excel file, and last one is to close the report. Here is the print dialogue box the user gets if they click on the print button:

    Click image for larger version. 

Name:	Capture.JPG 
Views:	13 
Size:	35.8 KB 
ID:	49068

    How would I get print preview as an option in this print dialogue window?

  9. #9
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Wow that is interesting how you have a dedicated form just for controlling the user interface. I do like that idea but that seems like it will be a bit time consuming for me at the moment.
    Its designed as an example app to demonstrate various examples showing the application interface can be managed in code.
    Normally, I just hide the Access application interface when my apps load. The nav pane & ribbon are automatically removed

    Clicking the taskbar icon does NOT restore the application interface with the code I now use

    Did you download & try the app? If not, I would do so as I think it will help you.
    It includes 3 different ways of displaying reports when the interface is hidden

    In answer to your question, you cannot get print preview to show up from the print dialog screen.
    It works in reverse - the Print dialog is shown when you click the Print button on the print preview ribbon.
    Try it for yourself

    Click image for larger version. 

Name:	Capture.PNG 
Views:	10 
Size:	48.6 KB 
ID:	49069
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-21-2022, 02:39 AM
  2. Replies: 3
    Last Post: 10-03-2019, 05:07 AM
  3. Replies: 5
    Last Post: 07-29-2014, 01:05 PM
  4. Do not display print dialogue box
    By Philw in forum Macros
    Replies: 1
    Last Post: 06-30-2014, 05:00 PM
  5. SaveAs Dialogue box
    By saqqer in forum Programming
    Replies: 8
    Last Post: 09-10-2009, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums