Results 1 to 6 of 6
  1. #1
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118

    Switch from Print Preview to Report View

    Good morning, everyone. I need to create a way for a user to switch from viewing a report in Print Preview to viewing it in Report View.



    The user does not have access to the ribbon in my database, so they can't just click on the Close Print Preview button. So, I need to create a command button, a keyboard shortcut, or some other way to allow the user to switch.

    I can't just write VBA to close the form and reopen it in Report View, since there is a user-inputted parameter, and I don't want the user to have to re-enter the parameter.

    Please help! Many thanks, folks.

    Matt

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Why not open the Report in Report view and have code, subsequently, open the same report in print preview? This way, when the user closes print preview, the report will appear in Report View.

  3. #3
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Thanks very much for the response. So, if I understand you correctly, you're saying that when I open the Print Preview, I should keep the Report View open as well? And that way, when the user closes the Print Preview, they go right back to the report view?

    That would definitely work for me, but I'm having trouble getting it done. I removed the VBA code that closed the Report View. However, when I click on the command button and open the Print Preview, it is still closing the Report View regardless. Also, now once the Print Preview opens, I can't click on anything, or scroll anywhere- everything is stuck. I can only fix it by pressing the stop button in the VBA window. Not sure what that's all about. Here's my code for the command button:

    Private Sub PrintPreview_Click()
    Dim IncidentValue As String
    IncidentValue = Me.Incident 'This saves the parameter as a variable
    DoCmd.OpenReport "rptViewEventInformation", acViewPreview, , "Incident=" & IncidentValue
    End Sub

    Any idea where I'm going wrong here?

    Matt

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I just did a quick test and I see what you mean. The open report will switch from Report View to Print Preview. It does not open a new instance of the Report Object. I do not recall exactly how, at the moment, but it is possible to use code to open a second instance of an Object if the object has a Module associated with it. Let me see if I can dig up how or maybe someone else remembers how to using Report_Reportname or something like that ...

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    The method for creating multiple instances of Forms does not seem to be working with Reports. I suspect the only way to achieve your goal is to create a copy of the Report Object. One Report Object can be dedicated for Report View and the other dedicated for Print Preview.

  6. #6
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Good idea! I did that and it worked. Thanks for your help.

    Still, it seems so odd to me that Access provides no way to use VBA or macros to do exactly what a built-in command button on the ribbon does.

    Oh, well. I can live with that. Thanks again!

    Matt

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

Similar Threads

  1. Replies: 5
    Last Post: 08-06-2015, 03:26 PM
  2. Replies: 1
    Last Post: 02-21-2015, 11:35 PM
  3. Replies: 6
    Last Post: 03-01-2014, 07:07 AM
  4. convert report view to print preview
    By DarrenUD in forum Reports
    Replies: 3
    Last Post: 03-19-2013, 12:21 AM
  5. Replies: 10
    Last Post: 07-25-2011, 12:07 PM

Tags for this Thread

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