How to refresh form view

G

Guest

I have a form with controls on it and a subform. The subform record source is
a query. The contols initiate code and alter the query. I use Requery to
update the form. However to get the final resuls I have to change the form to
design view and then back again. When I do this the correct results are
shown. How can I do this without changing to design view and back again?
 
A

Allen Browne

How do you issue the Requery?

Access does not change the Value of an unbound control until you exit it.
So, if the focus is still in the text box where you entered the criteria,
and the query is reading the value from that text box, it won't discover the
new value. Adding a command button to perform the requery would solve that,
because the focus has to leave the text box to get to the command button, so
the Value would be updated.

For an alternative approach, see:
Search form
at:
http://allenbrowne.com/ser-62.html
The article explains how to create a search form based on only the controls
where the user enters criteria, handling different field types. Includes
sample database to download.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top