From access 98 through 2003 this process worked
fine until I upgraded to 2013 access.
I have a form that is used for
shipping a parts back. A few fields have to be manually entered such as the
return date. The code for the print this part allows up to 3 copies to print.
Each copy has to have a different footer on it. This identifies which / who's
copy it is. I pass the who's copy data to the report and is put in a report
tag.
When the docmd to open report print executes I get only the first
copy printed. The report acts as if it does not allow the code to return to the
forms code to get the next who's copy.
The forms code use to change who's
copy is:
'Set up for copy to who -
(3/3=RPC,3/2=Repair,3/1=CE),(2/2=RPC,2/1=Repair),
'(1/1=Select
Who-1=RPC,2=Repair,3=CE)Copywho is variant = const()
'Me.Shipped =
True
While strCopies > 0
If strWho = 3 And strCopies = 3 Then CopyWho =
ToRpc
If strWho = 3 And strCopies = 2 Then CopyWho = ToRepair
If strWho =
3 And strCopies = 1 Then CopyWho = ToCe
If strWho = 2 And strCopies = 2 Then
CopyWho = ToRpc
If strWho = 2 And strCopies = 1 Then CopyWho = ToRepair
If
strWho = 1 And strCopies = 1 Then CopyWho = ToRpc
'Print DOA Tag or
Standard
If Me.Action_type = "DOA" Then
PrintDOA:
stDocName = "Part Tag
DOA Report"
'DoCmd.OpenReport stDocName, acPreview, ,
strlink
DoCmd.OpenReport stDocName, , , strLink
'Leave OpenReport here-if
put below for common will cause error when filtered to blank tag
ElseIf
Me.Action_type = "USED" Or Me.Action = "EXCESS" Or Left(Me.Action, 3) = "War"
Then
PrintTag:
stDocName = "Part Tag Report"
'DoCmd.OpenReport
stDocName, acPreview, , strlink
DoCmd.OpenReport stDocName, , ,
strLink
ElseIf Me.Action_type = "SpHandling" Then
stDocName = "Part Tag
SpHandling"
'DoCmd.OpenReport stDocName, acPreview, ,
strlink
DoCmd.OpenReport stDocName, , , strLink
End
If
strCopies = strCopies - 1
Wend
The reports code
is:
Option Compare Database
Option Explicit
Private Sub
Report_Close()
Me.Filter = ""
Me.Report.Tag = ""
Me.Section(4).Tag =
""
End Sub
Private Sub Report_Open(Cancel As
Integer)
Me.Report.Section(4).Tag = CopyWho
Me.Report.Tag =
reportBy
End Sub
Using at stop, I found that the code of the report never allows the stop but the code runs because the proper footer is printed.
It will stop and return to the main code when I use the preview mode in the main code for the report.