Solved

Requery and Refresh

Posted on 2003-11-20
6
636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
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…

627 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