Results 1 to 3 of 3
  1. #1
    KWasley is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    8

    Open a report based on current record in a form

    Hi,



    I am looking to be able to use a button in my form to open a report based on the current record in the form.

    I have looked around and seen many responses for similar questions however these are based on just a single form/report. Whereas in my scenario, I have subforms and subreports all involved.

    The way in which the button works with only one report is for example:

    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " & [RecordID]

    Basically, I need to be able to make the ID on the subreports equal the current ID on the form. So instead of having just one report equal to the record ID, I need;

    [subreport1].[recordID]=[recordID]
    [subreport2].[recordID]=[recordID]
    [subreport3].[recordID]=[recordID]
    [subreport4].[recordID]=[recordID]

    Really, I need some help being able to incorporate this into the code.

    Many thanks in advance,
    Kyle

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    You should be able to just set "Link Master Fields" and "Link Child Fields" both to recordID for each Subreport. That should make them automatically Filter out everything but the recordID being looked at in the parent Report.

    Then you can just use the regular method of opening the Report and everything should work.

  3. #3
    KWasley is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    8
    Hello,

    Thanks for the advice, it helped a lot.

    I originally didn't have any sort of content in the primary report so there were no fields to link it to. Now I have created one with the Record ID already set into it and the fields link appropriately.

    Cheers,
    Kyle

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

Similar Threads

  1. Replies: 9
    Last Post: 09-17-2013, 11:08 PM
  2. Replies: 3
    Last Post: 08-18-2012, 03:21 PM
  3. Open Current Report With Form Button
    By Rick5150 in forum Reports
    Replies: 8
    Last Post: 10-12-2011, 02:28 PM
  4. Query based on current record in form
    By bhsvendbo in forum Queries
    Replies: 1
    Last Post: 06-01-2010, 11:20 AM
  5. Open form to current record
    By rbpd5015 in forum Access
    Replies: 1
    Last Post: 08-28-2009, 01:53 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