Hey,
I've gotten helpful advice from the experts @ Tek-Tips in the past & thought i'd ask for assistance on this one.
When i attempt to use an on click event to print reports, the subform also prints. Is there a fix for this bug in Access 97 or is there something wrong with my code?
Here is the code i'm using to open a subform from which the user may select reports to be printed:
Here is the code i'm using to print out one of the reports from the subform:
When a user clicks on the button on the subform, the CoverLetter and OrderForm reports print out OK, but the Customer Subform also prints more than once. However, when the same on click event is used to run the same code from the Customers main form, the Customers form does not print out with the two reports. It's only a problem with the subform, which is something like a dialog box with the popup property set to yes.
I'm pulling what little hair i have left out over this one. Is there anyone who might be able to save me from going bald? ;-)
Thanks in advance!
I've gotten helpful advice from the experts @ Tek-Tips in the past & thought i'd ask for assistance on this one.
When i attempt to use an on click event to print reports, the subform also prints. Is there a fix for this bug in Access 97 or is there something wrong with my code?
Here is the code i'm using to open a subform from which the user may select reports to be printed:
Code:
'===========================================
Private Sub Command1_Click()
Dim strDocName As String
Dim strLinkCriteria As String
strDocName = "Customer Subform"
strLinkCriteria = "[ID]=" & "'" & Me![ID] & "'"
DoCmd.OpenForm strDocName, , , strLinkCriteria
End Sub
'=====================================
Here is the code i'm using to print out one of the reports from the subform:
Code:
'=====================================
Private Sub Command2_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "CoverLetter"
strFilter = "ID = Forms!frmIssues!ID and OrderNumber = Forms!frmIssues!OrderNumber"
DoCmd.OpenReport strDocName, acNormal, , strFilter
DoCmd.PrintOut acPrintAll, , , acHigh, 2, 1
strDocName = "OrderForm"
strFilter = "ID = Forms!frmIssues!ID and OrderNumber = Forms!frmIssues!OrderNumber"
DoCmd.OpenReport strDocName, acNormal, , strFilter
DoCmd.PrintOut acPrintAll, , , acHigh, 2, 1
DoCmd.Close acDefault, , acSavePrompt
End Sub
'==========================================
When a user clicks on the button on the subform, the CoverLetter and OrderForm reports print out OK, but the Customer Subform also prints more than once. However, when the same on click event is used to run the same code from the Customers main form, the Customers form does not print out with the two reports. It's only a problem with the subform, which is something like a dialog box with the popup property set to yes.
I'm pulling what little hair i have left out over this one. Is there anyone who might be able to save me from going bald? ;-)
Thanks in advance!