Results 1 to 4 of 4
  1. #1
    Adamcon25 is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2016
    Location
    Atlanta
    Posts
    2

    Closing select queries with no return values using macro

    I am looking for a solution for closing select queries returning no records within a database. I have macro which generates change fields after checking various updated tables in order to synchronize different instances of a financial reporting tool. It generates about 75 select queries which then must be closed individually. I am looking for a quicker solution than this method. I want queries containing records to remain open for review.

  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,518
    Sounds...unusual. Most of us don't let users into tables or queries. That said, I'd probably test using DCount() and only open queries that returned records.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Adamcon25 is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2016
    Location
    Atlanta
    Posts
    2
    Users aren't allowed into the Access database period. The admins are the ones needing to review the files containing values which are kicked out. That being said thank you for your contribution. Perhaps you could clarify where in the Macro I need to insert this DCount() chain and to what should I attach it? Are you referring to something I can do within the Macro or is this something needing to be done within the module?

  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,518
    Wherever you're opening the queries. I don't use macros, but you should be able to wrap each OpenQuery in an If/Then block that uses DCount(), and only open the query if the count is greater than zero.
    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: 3
    Last Post: 10-30-2016, 05:50 AM
  2. return to empty field before closing
    By RLehrbass in forum Access
    Replies: 8
    Last Post: 08-08-2015, 05:13 PM
  3. Error Message When Closing a Form w/ Macro
    By KCC47 in forum Programming
    Replies: 8
    Last Post: 11-14-2014, 03:35 PM
  4. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  5. Return all values from two queries
    By matteu1 in forum Queries
    Replies: 0
    Last Post: 08-18-2009, 01:02 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