Solved

Requery and Refresh

Posted on 2003-11-20
6
632 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

910 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

20 Experts available now in Live!

Get 1:1 Help Now