Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

What is a requery?

My boss told me I may need to use a requery when creating an interface for my Access database.
What is a requery?
What does it do?
What is it used for?
Why would someone want to use one?
What are its most common uses?
What are some common errors people make when using them?
What are some good tricks when using them?

Whoever gives me the the most relevant/detailed/useful answer(s) gets the points.
Let the games begin!!!
0
ouestque
Asked:
ouestque
  • 5
  • 4
  • 3
  • +4
3 Solutions
 
Rey Obrero (Capricorn1)Commented:
to get the complete explanation
from Access window   Help  type requery

from VBA window       Help  type requery
0
 
peter57rCommented:
Requery is an action not a 'thing' (Object)

You use requery when you want to renew the source of a form or a listbox/combobox control where records might be added or deleted by other users or by you using some code which affects the underlying table.  Updates to existing records are also brought in at the same time.

Commonly used where a record is being added to the table that supplies the data to a listbox or combobox to get an up-to-date list.
0
 
mbizupCommented:
From VBA Help:

You can use the Requery action to update the data in a specified control on the active object by requerying the source of the control. If no control is specified, this action requeries the source of the object itself. Use this action to ensure that the active object or one of its controls displays the most current data.


>What is a requery?
An action that reconciles data in a control with data that may have changed in that controls data source.

>What is it used for?
Making sure that data visible in a control or object is as current as the data in the underlying source.

>Why would someone want to use one?
as an example, if you have changed data in a table through vba or a seperate form, you would want to requery other open forms that are bound to the same data so that the most current data is seen.

>What are its most common uses?
- Cascading combo or list boxes.  If combo2's row source (drop down list) is dependent on a selection in combo1, you would requery combo2 from combo1's after update event so that the list visible in combo2 would include only those items related to the choice made in column1

- If records were deleted or updated through VBA or other means outside of the current form, that form can be requeried so that the most current data is visible.

0
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!

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
The above experts are correct.

All I can add here without duplicating the above would be comments that spiral downward into mindless frivoloty.  With that in mind, please accept a comment(s) as an answer, and move on.
0
 
peter57rCommented:
We are a bit short on mindless frivolity of late, Jim..........
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Yeah, I know.  Maybe I should see what I can do to get Nico invited back.  At least that would liven things up around here.
0
 
peter57rCommented:
Ok - I give in - we'll do without the mindless frivolity......I don't think we could manage Mr Lighthearted again!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
RE Nico ... see his comments here:

http://www.rustyrazorblade.com/index.php/2007/07/30/experts-exchange-should-be-removed-from-google-search-results/

He actually contacted me via email in my profile ... last week ... "switch to The Scripts" was the drift.

mx
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Last I remember he's up to about 10 similar rants in diffeent newsgroups, and they all stick to pretty much the same argument that got him tossed, plus 'thescripts is better, and treat people nicer'.

Notice that in many of them there are zero responses.  Also, in all these 'EE treats experts badly' rants he does not admit to being a Moderator here, and having one of the worst track records of Moderators-treating-experts badly.   The proper analogy would be the prison guard that abuses inmates whining about inmate abuse.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
jHo ... that's why I posted that ... and though I did respond to his personal email, I pretty much said that 'life is good here for me on EE and that I don't really have any issues' ... and ... that I really don't particularly care for the Scripts UI either, lol.

mx
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
He's contacted a bunch of people.  Also, last I saw he's a moderator at thescripts.com.
0
 
Leigh PurvisDatabase DeveloperCommented:
>> "We are a bit short on mindless frivolity of late,..."

Shhhhhhhh!
Some of us are trying to sleep.


Any break from the monotony would be welcome, I agree Pete.
Whatever the cause.

And now - to prove how dynamic and exciting I am...
Requery... <all groan>
As mentioned - requeries of Forms occur to display appended or deleted rows.

>>> What are some common errors people make when using them?
Overuse and unnecessary use.
A requery of a form requires the the current record be committed, and a read of the database be executed again.
In multi-user scenarios - this can be a drain on resources that isn't always required.
A Refresh will update existing data (though without the appended or deleted included).

Another error - requerying and expecting to be able to undo still.  The commit performed by a Requery is powerful - and none of the undo methods will be effective upon it.

>>>  What are some good tricks when using them
Not having to very often? :-p
Actually re-assigning the recordsource when a requery alone doesn't cut it.


I have to say - I'm fascinated by this notion of the boss' comment.
I'm picturing a line of folks sat at PC's.
A boss strolling casually past behind them.
"You there - you can use command buttons on your forms".
Walks on a little further...
"Hey!  You may need to use a requery when creating an interface for that Access database"
Walks further...
"Tut tut... No listboxes *anywhere*???"

It's just such a strangely sweeping statement.
(To the extent that is almost sounds like the Boss doesn't really know the implications himself).
i.e. *why* might you need to requery the data? :-S
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Sounds like to me ... the boss has become Corrupted and needs to be DECOMPILED !!! ... and maybe just left in that state!

mx
0
 
mbizupCommented:
>  I'm fascinated by this notion of the boss' comment.
I am too.  She also made this unusual request:
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Q_22751895.html
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Clearly, this boss is modulating in a frequency time complex - easily predicted by Schrödinger's Equation - which undulates between this ... and parallel universe time continuum!

mx
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Drat.  I gave somebody the impression that I am opposed to mindless frivoloty, or conversational threads.  That was not my intent.

<awkward pause>

Hey ouestque, how we doing on your question?  Got 'er down?
0
 
ouestqueAuthor Commented:
Yes thanks for the feedback guys. I am reading through and deciding on points.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 5
  • 4
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now