Results 1 to 9 of 9
  1. #1
    EricRex is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    May 2024
    Location
    Colorado
    Posts
    85

    Copied Query Referencing Source Query???

    Hey there,



    I have a query named TestQuery that runs fine and gives me the results I want:
    Code:
    SELECT TradeDate, EntryTime, Direction, Symbol, Shares, TrailStop, StopLoss, R10, ATR, ROUND(TrailStop/ATR, 2) AS TS_ATRRatio, ROUND(TrailStop/R10,2) AS TS_R10Ratio, cTradePL, Pattern, Notes, EntryOrder, ExitOrder
    FROM StockTrades
    WHERE Mistakes LIKE "*Tight*";
    Then, I copy that query using Ctrl+C, Ctrl+V and give it a new name, qryTightExitsbyExitOrder.

    When I run that copied query, it comes up with a prompt for the TestQuery.Symbol and all of the other values. But there's no reference in the second query to TestQuery!

    I've tried this a couple of times and it always malfunctions the same way. Copying and pasting the code into the second query still malfunctioned.

    I did get it to work as expected by copying and pasting the code into a new query and saving that new query as the second query name, replacing that second malfunctioning query.

    What gives???

    Cheers,
    Eric

  2. #2
    EricRex is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    May 2024
    Location
    Colorado
    Posts
    85
    New wrinkle. I just had this happen on a second, related query. The first one works fine and the copy needs inputs from the first.

    One other piece of info: I put * in all of the input prompts and it works as it should.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    This is a shot in the dark, but open the original query in design view and see if there's anything in Parameters on the Show/Hide tab.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    jojowhite's Avatar
    jojowhite is offline Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    434
    delete the new query, qryTightExitsbyExitOrder.
    open TestQuery query.
    in SQL View, copy (ctrl-C) the SQL string.
    Create new query.
    on SQL view of the new query, paste the SQL string (Ctrl-V).
    Save the new query as qryTightExitsbyExitOrder.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I've never encountered that.

    Why copy query? Could just rename. So why have a TestQuery object?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    EricRex is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    May 2024
    Location
    Colorado
    Posts
    85
    Quote Originally Posted by June7 View Post
    I've never encountered that.

    Why copy query? Could just rename. So why have a TestQuery object?
    Believe it or not, this fails also! Same result, prompts for TestQuery.Symbol etc values.

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Did you quote the wrong post, because that makes no sense to me? FWIW I tried copying a query the same way and giving it a different name. When I run it, it does the same as the original query and does not prompt. I checked both sql statements and they are identical.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,936
    Perhaps the original query has the filter and/or sort properties populated?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Want to provide db for analysis?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 7
    Last Post: 01-09-2018, 05:28 PM
  2. Replies: 9
    Last Post: 10-27-2017, 05:06 PM
  3. Replies: 4
    Last Post: 07-16-2015, 11:39 PM
  4. Help with RunSQL string copied from an update query
    By PlamenGo in forum Programming
    Replies: 14
    Last Post: 04-23-2014, 01:32 PM
  5. Replies: 3
    Last Post: 05-08-2013, 01:29 PM

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