Results 1 to 4 of 4
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    VBA code change physical query (query object)

    Can VBA code change an existed query. The query on the left side of the window that you see and had written.
    For example in the query is as:

    SELECT *


    FROM tb
    WHERE fielda = “app”

    To

    SELECT *
    FROM tb
    WHERE fielda = “toys”

  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 change the SQL of a saved query with a DAO QueryDef. That said, in your example I'd just use a criteria pointing to a form control (a parameter query).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    My query is more complex than that. That is just a simple example. Can you show me an example of how VBA can change an existed physical query ?

  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
    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. Code only updating after physical click
    By Mohibullah in forum Programming
    Replies: 3
    Last Post: 11-23-2016, 03:42 PM
  2. Create Query Object vs Hard Code
    By sstiebinger in forum Queries
    Replies: 5
    Last Post: 05-13-2015, 08:37 AM
  3. Replies: 6
    Last Post: 04-22-2015, 03:15 PM
  4. Replies: 2
    Last Post: 06-15-2012, 07:41 PM
  5. Replies: 3
    Last Post: 04-10-2012, 04:42 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