Results 1 to 6 of 6
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071

    Report Form


    I have an Access 2010 Database Using the Navigation Control for the menu system. one of the pages is a Reports page it has 4 Controls 2 textboxes 1 combo box and a command button. The 2 textboxes are for begin date and end date the combo box allows the user to select a report and the command button opens the Report in Print Preview mode. It all works perfectly. The issue is if the user clicks on the printer icon in the toolbar the form is printed not the report. why? the report has the focus at least I'm pretty sure it does. What am I missing? How do I get the report to print instead of the form?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    it may be using the wrong code.
    make another button to print to printer,
    docmd.openreport lstBox

  3. #3
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    I use the docmd.openreport

    Code:
        Dim strReports As String
        Select Case Me.cbo_Reports
            Case Is = 2 'Event Schedule
                strReports = "rpt_Event_Schedule"
            Case Is = 1   'Newborns
                strReports = "rpt_OB_Deliveries"
            Case Is = 3  'Birthday List
                strReports = "rpt_Birthday_List"
            Case Is = 4   'Birthday Mailing Labels
                strReports = "Labels Qry_Birthday_List"
                DoCmd.SetWarnings (False)
            Case Is = 5    'Event Attendance
                strReports = "rpt_Event_Attendance_Report"
            Case Is = 6    'Email List
                strReports = "rpt_Sr_Prog_Email_List"
            Case Is = 7    'Full Mailing Labels
                strReports = "rpt_Senior_Programming_Mailing_List"
                
        End Select
    '    If IsNull(strReports) Or Len(strReports) = "" Then
     '       MsgBox "No Report Selected", vbCritical, "Report Error"
      '  Else
            DoCmd.OpenReport strReports, acViewPreview
       ' End If
            DoCmd.SetWarnings (True)
    This is the code I use for the command button. It works Opens the report and displays it on the screen. The user looks over the report and then clicks on the Printer Icon in the taskbar and sends it to the Printer. Only what's printed is the form not the report. What I'm thinking is that even though the Print Preview of the Report is what's showing on the screen the form must still have the focus what I don't get is why. If a report is sent to the screen in Print Preview mode even in code shouldn't it have the focus it's what is showing on the screen? Why wouldn't it have the focus?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    I think this line opens the selected report

    Code:
    DoCmd.OpenReport strReports, acViewPreview
    But I also think it is this code you have shown that focus returns to after the
    DoCmd is executed.

  5. #5
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    So how do I keep focus on the report until I close it?

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    You are opening the report in Preview,
    you could have a button with a click event to open the report in
    ---acViewNormal (default) Send the report to the current default printer queue

    Good luck.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-09-2015, 09:02 AM
  2. Replies: 3
    Last Post: 10-19-2015, 11:05 PM
  3. Replies: 3
    Last Post: 03-11-2013, 05:11 PM
  4. Replies: 1
    Last Post: 06-26-2012, 08:19 PM
  5. Replies: 4
    Last Post: 12-13-2010, 05:33 PM

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