Solved

Requery and Refresh

Posted on 2003-11-20
6
631 Views
Last Modified: 2008-02-26
Why is it that using the requery command can appear to caused what appears to be prolonged requery that last 5 to 10 seconds?  I says appears as the computer screen freezes and flicker for a few seconds before the user has control of the system again.

Ashley
0
Comment
Question by:jezella
6 Comments
 
LVL 6

Accepted Solution

by:
bknouse earned 63 total points
ID: 9789588
The requery action or method actually requeries the underlying datasource of the specified object.  This creates a new recordset on which the object is based.  After the requery any records changed that don't match the criteria or deleted records are not returned.  Any new records added that match the criteria are included.
The refresh command updates the current recordset.  That is any records deleted are removed.  Even though records may have changed and no longer meet the entered criteria, those records remain.  Any new records added since the last requery are not returned.
Depending on the size of the underlying data, a requery could require a few seconds to minutes.

Brent
0
 

Expert Comment

by:stawicki
ID: 9789640
It can depend on how you make the requery - the following  text in quotes is from microsoft access HELP -   is this a case where you really want to be using refresh rather than requery?


"If you want to requery a control that isn't on the active object, you must use the Requery method in Visual Basic, not the Requery action or its corresponding Requery method of the DoCmd object. The Requery method in Visual Basic is faster than the Requery action or the DoCmd.Requery method. In addition, when you use the Requery action or the DoCmd.Requery method, Microsoft Access closes the query and reloads it from the database, but when you use the Requery method, Microsoft Access reruns the query without closing and reloading it. Note that the ActiveX Data Object (ADO) Requery method works the same way as the Microsoft Access Requery method"
0
 
LVL 23

Assisted Solution

by:heer2351
heer2351 earned 62 total points
ID: 9791650
bknouse is almost correct, the following is a quote from the access help:

<quote>
The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.
</quote>

But to answer your question, since a requery realy requeries the database it can take a while depending on the speed of the query. You could try to enhance the performance by tuning the query.
0
 
LVL 9

Expert Comment

by:ornicar
ID: 10066336
----------------------------------------------------------------------------------------
This question has been abandoned and needs to be finalized.
 You can accept an answer, split the points, or get a refund (information at http:/help.jsp#hs5)
  If you need a moderator to help you, post a question at Community Support (http:/Community_Support/)

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ornicar
Cleanup Volunteer

---------------------------------------------------------------------------------------------
0
 
LVL 32

Expert Comment

by:jadedata
ID: 10084090
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: bknouse {http:#9789588} & heer2351 {http:#9791650}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jadedata
EE Cleanup Volunteer
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now