Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    Ohio
    Posts
    7

    Unanswered: Report Code is not allowing return to main code

    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

  2. #2
    Join Date
    May 2002
    Location
    Ohio
    Posts
    7
    I found that if I do not use a filter or a where condition in the DoCmd.OpenReport then the code returns to continue on. The solution was to put the where in the report so as to select only the 1 record that needs 3 copies printed each with a different footer. It is strange that the code has worked for years until I upgraded to 2013 access and that if I use the preview mode it also works in the 2013 access.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •