Changing query criteris for a Main Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 2003; Windows XP Pro

Using a combo box in the form header, and it's After_Update event I am clear
on how to display and refresh or requery a subform based on criteria changes
in the subforms underlying query.

So far, I have had only failure, using a similar approach to have a combo
box on the form, in conjunction with it's After_Update event, provide
criteria selection options for the query underlying the main form itself (not
a subform). Is this a flawed approach, or is there a trick required here? I
have wondered if an option group is a better route, but am trying to preserve
the limited real-estate on my form.

The reference material I have found on the requery function always seems to
imply the need for a "control" as the target for a requery, but not a form.
Can requery work when the objective is to requery and reload a complete form?

As always, thanks in advance for wonderful guidance.
 
Base your main form on a query that includes, as a criterion for the record
ID, something like:

Forms!YourFormName!YourComboBox

This presumes that your combo box has, as a bound column, the ID
corresponding to the record you will want in the main form, and whatever
other columns are needed for the user to pick the correct record.

When this form first loads, there's nothing in the combo box, so nothing in
the form.

In the combo box's AfterUpdate event, add something like:

Me!Requery

to force the main form to re-run the query. This time, however, it
uses/finds the ID of the row selected in the combo box.

Or have I misunderstood?

Regards

Jeff Boyce
<Office/Access MVP>
 
Thanks for the reply Jeff,

Your suggested method is clear, but perhaps my explanation of what I am
hoping for was not.

My combo box does not provide criterion for the selection of a unique single
record (as in a ClientID) but a recordset as in a subset from the Client data
table. All clients who received assistance in the month of August ?? My
objective is to establish the new record set, and the first record will
display based on an alpha sort on the last name. The form has a button to
step through the records of the recordset.

Hope this clarifies my issue.

....my continued thanks.
 

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

Back
Top