Results 1 to 5 of 5
  1. #1
    JC-Access is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    4

    VBScript query using access union query


    I have a large union query I would like to extract data out of, but I am not sure how I should format the query.
    The name of the union query in access is "PH6-Combined-Dependencies"

    Can I write a query to select records out of a union query in access?

    Below is an example of a query similar to what I would like to use in the vbscript.

    vbscript query:
    Code:
    Set QDF4 = cdb.CreateQueryDef(Tab4, "SELECT [Backup Properties].* FROM [Backup Properties]WHERE (([Backup Properties].Application)='" & strAppName & "')")

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Yes , you can query on queries.

  3. #3
    JC-Access is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    4
    Can you please give me an example of what that query would look like?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Why are you using QueryDefs? Why do you need to programmatically create/modify query object?

    Select from UNION query object same as from a table or other SELECT query.

    Use Access query builder to help structure SQL statement then adapt for VBA.
    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.

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    select * from qsMyQuery where [state]="NY"

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

Similar Threads

  1. vbscript open access db and execute sub
    By Auto in forum Programming
    Replies: 1
    Last Post: 04-22-2015, 01:29 PM
  2. Replies: 1
    Last Post: 10-16-2014, 10:36 PM
  3. Replies: 2
    Last Post: 11-21-2012, 09:57 AM
  4. Replies: 2
    Last Post: 12-22-2011, 07:53 PM
  5. Replies: 0
    Last Post: 12-28-2008, 01:56 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