Results 1 to 4 of 4
  1. #1
    brew is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    16

    Question Printing multiple reports for one record

    Hi,



    I'm intending to print a number of reports for the current record from a print button on a form. I have what i think the code should look like but when the print button is pressed it prints the first report (Title Page) as desired but doesn't print the other 3 and prompts for an ID. How do i get it to keep the same record 'selected'?

    Code:
    Private Sub cmdPrint_Click()
    
       Dim strWhere As String
    
        If Me.Dirty Then    'Save any edits.
            Me.Dirty = False
        End If
    
        If Me.NewRecord Then 'Check there is a record to print
            MsgBox "Select a record to print"
        Else
            strWhere = "[ID] = " & Me.[ID]
            DoCmd.OpenReport "Title Page", acViewNormal, , strWhere
            DoCmd.OpenReport "Information Index", acViewNormal, , strWhere
            DoCmd.OpenReport "Sterilisation Sheet", acViewNormal, , strWhere
            DoCmd.OpenReport "Label Request", acViewNormal, , strWhere
        End If
    
    End Sub
    Thanks in advance for any help.
    James

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The prompt for ID would imply that field isn't in the record source of the other report(s). The same record would stay "selected", and strWhere wouldn't (shouldn't) change.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    brew is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    16
    Thanks pbaldy,

    Changing the record source to the table name rather than the individual fields, which seem to of auto populated during report design has sorted the problem.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 05-23-2011, 01:52 PM
  2. Printing multiple reports at once based on condition
    By justinwright in forum Reports
    Replies: 24
    Last Post: 04-13-2011, 01:40 PM
  3. Printing reports off a list box
    By kbandong1 in forum Reports
    Replies: 3
    Last Post: 03-05-2011, 09:51 PM
  4. Printing multiple reports with one command
    By AKQTS in forum Reports
    Replies: 2
    Last Post: 09-24-2010, 09:32 AM
  5. Printing Reports....
    By Danny Christie in forum Reports
    Replies: 1
    Last Post: 12-06-2006, 05:51 PM

Tags for this Thread

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