Results 1 to 3 of 3
  1. #1
    worldwidewall is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    23

    Quick Return Query


    Hi

    I have a query that runs just fine and takes about 1 minute to run on average. I have vba code that uses Dlookup to determine if the query returns any records. The problem is that each time it runs it has to crunch all the data, all I care about is if there is any result at all. Is there a way to get the query to stop after it finds one record to speed things up greatly?

    Thanks

    Dave

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,962
    No. Queries run until they are done. This is why calling VBA functions from query has risks. If the code is flawed and has infinite loop, a query would never finish.

    There might be alternatives you could employ in VBA code using recordsets and looping structures.
    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
    worldwidewall is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    23
    That's what I was afraid of, thanks.

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

Similar Threads

  1. return max/min value in single query
    By garamon in forum Access
    Replies: 2
    Last Post: 10-23-2011, 03:50 PM
  2. Quick SQL Query question.
    By Suoipoc in forum Access
    Replies: 4
    Last Post: 09-06-2011, 09:10 PM
  3. New eyes on a quick update query
    By Lorlai in forum Queries
    Replies: 3
    Last Post: 07-14-2011, 09:51 AM
  4. quick query syntax questions
    By cowboy in forum Access
    Replies: 6
    Last Post: 02-03-2010, 06:10 PM
  5. Return all records from Query
    By ysrini in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 09:52 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