Results 1 to 4 of 4
  1. #1
    aebstract is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    19

    Use report textbox in sub-report record source query

    I have a report that has one sub-report within it. I have a textbox in the Detail section of the report that I want to pass in to my sub-report and use within it's "record source" sql query. I've tried several different things but am unsure how to accomplish this. I've searched a good bit and have come up short as well. Trying to use "textbox50" in the WHERE clause.



    Code:
    SELECT dbo_MIBORD.opCode, dbo_MIBORD.milestone
    FROM dbo_MIBORD
    WHERE (((dbo_MIBORD.milestone)=True) AND ((dbo_MIBORD.bomItem)=[Me]![text50]));

  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
    You can't use "Me" outside VBA. Try the full reference:

    Reports!ReportName.text50

    You'll find more descriptive object names very helpful down the line.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    aebstract is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    19
    Quote Originally Posted by pbaldy View Post
    You can't use "Me" outside VBA. Try the full reference:

    Reports!ReportName.text50

    You'll find more descriptive object names very helpful down the line.
    Thanks a lot! This did it perfectly. Normally, I would be more descriptive in things like the textbox name for reference, but this is just a quick small and simple report so I wasn't too worried in this case.

  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,521
    Happy to help!
    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: 14
    Last Post: 12-29-2016, 12:34 AM
  2. 1 record source 2 columns in a report
    By trident in forum Reports
    Replies: 0
    Last Post: 03-27-2016, 12:39 AM
  3. Report with no Record Source
    By NISMOJim in forum Reports
    Replies: 13
    Last Post: 07-19-2014, 02:29 AM
  4. Getting to SQL in report record source
    By Monterey_Manzer in forum Reports
    Replies: 3
    Last Post: 12-04-2012, 01:44 PM
  5. How to modify sub report record source
    By EddieN1 in forum Reports
    Replies: 4
    Last Post: 12-12-2011, 06:57 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