Results 1 to 3 of 3
  1. #1
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60

    acOutputQuery command is erasing the query contents?

    I am using the following code to export query results to Excel.
    DoCmd.OutputTo acOutputQuery, "QueryName", "ExcelWorkbook(*.xlsx)", strFileName & ".xlsx", True, , , acExportQualityScreen

    This command is intermittently erasing the query contents (the stored query remains in the database however is empty)

    ?!?

    Query is pretty basic / essentially as follows;
    SELECT
    FROM


    WHERE (Value Criteria, Form Reference Criteria - combination of ANDs and ORs)
    GROUP BY

    Don't think it matters but on the same form that is calling this acOutputQuery command, I have a field with its control source being set to:
    ......ControlSource = "=" & DCount("*", "QueryName")


    I have no idea why its occurring, debugging and code watching isn't showing me why its happening.
    ?!?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    did you try setting the Query to snapshot, instead of dynaset?

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

Similar Threads

  1. Export specifications with DoCmd.OutputTo acOutputQuery
    By Mattbro in forum Import/Export Data
    Replies: 2
    Last Post: 03-21-2014, 08:17 AM
  2. Replies: 2
    Last Post: 10-15-2013, 09:30 AM
  3. Replies: 3
    Last Post: 02-01-2013, 12:26 PM
  4. Query contents are deleted after exporting the query results
    By alfcee in forum Import/Export Data
    Replies: 6
    Last Post: 11-13-2012, 09:35 AM
  5. Replies: 5
    Last Post: 04-18-2012, 12:04 PM

Tags for this Thread

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