Results 1 to 7 of 7
  1. #1
    tstoneami is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    71

    Invoke report with DoCmd previews all records - Please help!

    Hello Folks;

    I use a method similar to this:

    Private Sub Command175_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 = "[Repetitive # or Name assigned] = """ & Me.[ Repetitive # or Name assigned] & """"
    DoCmd.OpenReport "Repetitive Listing", acViewPreview, , strWhere
    End If
    End Sub

    Where I get a loan number from a form. It actually previews the correct record as the first report, but doesn't tie the correct sub report - and proceeds to print all the records of the table associated with the sub report.

    If I use an alternate DB with just a small number of records, and print them all (no docmd), they are properly associated.

    I am at my wits end...do I need to also pass the parameters to the subreport?

    Any help worshipped...and thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Normally a subreport is kept in sync with the main report with master/child links (properties of the subreport control). If you used the wizard to add the subreport, it would have asked about linking fields. Are those appropriate?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tstoneami is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    71
    I didn't use the wizard. Made the subreport separately and stuck it in the main report. I always saw the proper linking field in the property for master/child, and just now clicked the ... icon to see what the dialog might indicate. It gave me an error (The expression you entered refers to an object that is closed or doesn't exist.). The source object is the main report.

  4. #4
    tstoneami is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    71
    Correction, the source object is the name of the subreport.. The Master and child fields had previously referenced a field on the main report.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    tstoneami is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    71
    Hey folks;

    I figured this out. The subreport needs a match to the field on the main report in order to link the two via the Link Master/Child Fields. The simple fix was to put a common field on the subreport and make it invisible. It's then available in the Link Dialog. Thank you for your interest in helping me - hope this discovery helps someone else.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it sorted out.
    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: 1
    Last Post: 03-16-2013, 09:20 PM
  2. Replies: 10
    Last Post: 03-12-2013, 01:41 PM
  3. Replies: 3
    Last Post: 02-05-2013, 05:07 PM
  4. Multiple Print Previews at One Time
    By EddieN1 in forum Reports
    Replies: 2
    Last Post: 01-30-2012, 12:29 PM
  5. Replies: 0
    Last Post: 10-04-2008, 07:23 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