Hi!
Hope someone may help me out with this one:
THE GOAL: I'm trying to improve the design of a form by removing the buttons used to print reports to a subform that pops up like a dialog box. This custom-made dialog box has one button for each report a user needs to print (nine reports in all).
THE OBSTACLE: When i use an on-click event to run the code to print reports from this subform, the subform itself prints out with the reports (which wastes toner). This problem does not occur when i use an on-click event to run the same code from the main form.
Here is the VBA code i'm using to open the subform:
'=============================
Private Sub Command178_Click()
On Error GoTo Err_Command178_Click
Dim strDocName As String
Dim strLinkCriteria As String
strDocName = "frmIssues_501"
strLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm strDocName, , , strLinkCriteria
Exit_Command178_Click:
Exit Sub
Err_Command178_Click:
MsgBox Err.Description
Resume Exit_Command178_Click
End Sub
'============================
Here is the VBA code i'm using to print out the reports:
'============================
Private Sub Command17_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "Cover"
strFilter = "SSN = Forms!frmIssues!SSN and IssueNumber = Forms!frmIssues!IssueNumber"
DoCmd.OpenReport strDocName, acPreview, , strFilter
DoCmd.PrintOut acPrintAll, , , acHigh, 2, 1
strDocName = "LTR-ERI-ATPNAS"
strFilter = "SSN = Forms!frmIssues!SSN and IssueNumber = Forms!frmIssues!IssueNumber"
DoCmd.OpenReport strDocName, acPreview, , strFilter
DoCmd.PrintOut acPrintAll, , , acHigh, 2, 1
DoCmd.Close acDefault, , acSavePrompt
End Sub
'=============================
We're using Access 97 (i know--it's a dinosaur, but it is all we have to work with). Any suggestions as to how to stop the subform from printing with the reports will be appreciated!
Thanks in advance!
Christopher in Indiana
Hope someone may help me out with this one:
THE GOAL: I'm trying to improve the design of a form by removing the buttons used to print reports to a subform that pops up like a dialog box. This custom-made dialog box has one button for each report a user needs to print (nine reports in all).
THE OBSTACLE: When i use an on-click event to run the code to print reports from this subform, the subform itself prints out with the reports (which wastes toner). This problem does not occur when i use an on-click event to run the same code from the main form.
Here is the VBA code i'm using to open the subform:
'=============================
Private Sub Command178_Click()
On Error GoTo Err_Command178_Click
Dim strDocName As String
Dim strLinkCriteria As String
strDocName = "frmIssues_501"
strLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm strDocName, , , strLinkCriteria
Exit_Command178_Click:
Exit Sub
Err_Command178_Click:
MsgBox Err.Description
Resume Exit_Command178_Click
End Sub
'============================
Here is the VBA code i'm using to print out the reports:
'============================
Private Sub Command17_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "Cover"
strFilter = "SSN = Forms!frmIssues!SSN and IssueNumber = Forms!frmIssues!IssueNumber"
DoCmd.OpenReport strDocName, acPreview, , strFilter
DoCmd.PrintOut acPrintAll, , , acHigh, 2, 1
strDocName = "LTR-ERI-ATPNAS"
strFilter = "SSN = Forms!frmIssues!SSN and IssueNumber = Forms!frmIssues!IssueNumber"
DoCmd.OpenReport strDocName, acPreview, , strFilter
DoCmd.PrintOut acPrintAll, , , acHigh, 2, 1
DoCmd.Close acDefault, , acSavePrompt
End Sub
'=============================
We're using Access 97 (i know--it's a dinosaur, but it is all we have to work with). Any suggestions as to how to stop the subform from printing with the reports will be appreciated!
Thanks in advance!
Christopher in Indiana