Results 1 to 3 of 3
  1. #1
    rcwiley is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Jun 2013
    Posts
    2

    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

    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.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Could you please edit your post and format the code using the Code tags (the # button on advanced)?
    Here's a good, free indenter: http://www.oaltd.co.uk/Indenter/Default.htm

  3. #3
    rcwiley is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Jun 2013
    Posts
    2
    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.
    Now to fix the many other docmds that don't work. If this is the solution it is only a bandage. The Filters and Where should work since Microsoft says it does.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 05-28-2013, 09:11 AM
  2. Replies: 1
    Last Post: 05-04-2013, 12:19 PM
  3. Replies: 3
    Last Post: 07-20-2012, 11:41 AM
  4. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  5. Replies: 6
    Last Post: 11-05-2010, 10:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums