Requery a form that has a dynamic recordsource

  • Thread starter karen scheu via AccessMonster.com
  • Start date
K

karen scheu via AccessMonster.com

I have two forms. The first contains filter selections. When View button
is selected, I check the filter selections and build a Where string. Then I
open the second form as follows:
DoCmd.OpenForm "Frm201Main", , , strWhere.

On the second form I have a button that opens a third form which allows users
to update comments. When the user saves the comments, he should return to
the second form and the changes appear on the second form. In order to get
the changes to appear dynamically, I have to requery the second form. My
question is that if I simply do a .requery on the form and the form's record
source is a query that contains all the data instead of the filters that were
used when the form was opened, won't the performance be bad? It seems slow
to me, but I don't know how to handle this. Should I be setting the record
Source of the form dynamically instead of opening it with a where string?

Thanks,
Karen
 
P

PC Datasheet

Rather than building a Where string with the View button, create a QueryDef.
You'll find QueryDef in the Help file. Basically, a QueryDef redefines an
existing query. Use that query as the recordsource of your report. Your
filters will be in the query after you click the View button and the query
will not change when you open the third form. Then all you need do when you
close the third form is requery the second form and your comments from the
third form will be in the filtered records on the second form.
 

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