Results 1 to 4 of 4
  1. #1
    belarin is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4

    help with macro for a button on a report linking to another specific report

    This might be a little difficult to describe so bare with me.

    In my current table are two important columns one contains a name the other a category. I currently have a report (call it R1) that asks for a name and queries the table for that name and then displays all the fields in the row with that name in a printable layout, and a second report (R2) that queries for a given category and then displays just the names of all items that have that category (kind of like a contents page).



    I know that buttons can be added to reports and made to function through the use of macros so what I would like to do is add a button to the R2 report beside the name that when clicked will open the R1 report (well a copy of it that isn't linked to the query R1 normally opens with) for the item it is next to without having to type in the name. Currently I have it using the OpenReport command targeting R1 which pops up it's message box asking for a name and this works fine but I would like it to work without having to type anything.

    is there a way I can do this?

  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,518
    Have you tried adding a wherecondition?

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Not sure that fits the bill. As I interpret, belarin wants to open the name report from the category report and filter it to the name contained in one of the many records of the category report. Where criteria is needed for this of course, but it's not enough IMHO. The question is probably about how to decipher which record and which field in order to accomplish that, rather than the prompt currently used.

    belarin, the behaviour you describe is often done by double clicking on a report row and using the value of one (or more) of the fields as criteria for some action to be taken. That is because the record in the report can accept the double click action and the row clicked on can be known. If you place a single button in a report header or footer, once it takes the focus, there is no current record so how do you specify which record is desired, let alone which fields? AFAIK, the only way you can do this is to put the button in the detail section so that it is a control on the record, like the other ones. It will appear on each record, but can be used to distinguish between one record and another this way.
    Last edited by Micron; 05-28-2017 at 07:11 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You must have interpreted this differently than I did:

    Quote Originally Posted by belarin View Post
    add a button to the R2 report beside the name that when clicked will open the R1 report...for the item it is next to
    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: 8
    Last Post: 05-29-2015, 11:52 AM
  2. Replies: 26
    Last Post: 09-18-2014, 10:18 AM
  3. Linking button on form to report
    By robertdudley95 in forum Forms
    Replies: 19
    Last Post: 11-09-2011, 12:14 PM
  4. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  5. Replies: 3
    Last Post: 01-14-2010, 08:32 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