Screen Prompt to Print another report

spectraflame

Well-known Member
Joined
Dec 18, 2002
Messages
830
Office Version
  1. 365
Platform
  1. Windows
Currently I have a form set up so that the user can click the print button and it prints the information from the form on a defined report along with a second report which sometimes is not needed. Basically this is wasting a sheet of paper each time and I would like to give the user the option.

I would like to be able to prompt the user with a YES / NO option to print or not print the second report.

Is this possible?

Thanks,
Matthew
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Matthew

What code are you currently using?
 
Upvote 0
Below if what I am using for the onclick event for my print button. This is printing the desired report for the current record and the second part of the code is printing an inventory sheet based on the department from the users input on the form. I was hoping to just give the user a prompt between the printing of the 2 reports to print the inventory page or not print it. I hope this what you are looking for.

Private Sub Print_Record_Click()
On Error GoTo Err_Print_Record_Click

Dim strDocName As String
'Dim strWhere As String
strDocName = "WorkOrderrpt"
'strWhere = "[RecordID]=" & Me!RecordID
'DoCmd.OpenReport strDocName, acPreview, , strWhere
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport strDocName, acNormal, , strWhere

Dim strDocName2 As String
Dim strWhere2 As String
strDocName2 = "Invenrpt"
strWhere2 = "[WOType]=" & Me!WOType
'DoCmd.OpenReport strDocName, acPreview, , strWhere
If Me.WOType = "Electric" Or Me.WOType = "Water" Or Me.WOType = "Sewer" Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport strDocName2, acNormal, , strWhere
Else
End If

Exit_Print_Record_Click:
Exit Sub

Err_Print_Record_Click:
MsgBox Err.Description
Resume Exit_Print_Record_Click

End Sub
 
Upvote 0
It's unclear when you want to print or not print the second report.

But perhaps something like this will work.
Code:
Private Sub Print_Record_Click()
Dim strDocName As String
Dim strDocName2 As String
Dim strWhere2 As String
Dim valPrintReport2

    On Error GoTo Err_Print_Record_Click
    
    strDocName = "WorkOrderrpt"
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    DoCmd.OpenReport strDocName, acNormal, , strWhere
    
    valPrintReport2 = MsgBox("Do you want to print the 2nd report", vbYesNo, "Print 2nd report")
    
    If valPrintReport2 = vbYes Then
        strDocName2 = "Invenrpt"
    
        strWhere2 = "[WOType]=" & Me!WOType
        
        Select Case Me.WOType
            Case "Electric", "Water", "Sewer"
                DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
                DoCmd.OpenReport strDocName2, acNormal, , strWhere
            Case Else
                ' do nothing
        End Select
        
    End If
    
Exit_Print_Record_Click:
        Exit Sub
    
Err_Print_Record_Click:
        MsgBox Err.Description
        Resume Exit_Print_Record_Click
    
End Sub
 
Upvote 0
Thanks,

With a little modification, I think that I can make it fit my needs.

Thanks again,
Matthew
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,624
Members
451,778
Latest member
ragananthony7911

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top