Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Requery and Refresh

Posted on 2003-11-20
6
Medium Priority
?
638 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 252 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 248 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 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