Updating subforms

  • Thread starter Thread starter Tray
  • Start date Start date
T

Tray

I have a form that I'm using to show sales relating a specified month.

On this form I have 3 combo boxes - One to select the company, one for the
month and one for the year.

I have created a query which takes all the fields from the sales table. I
have added this query as a subform, so that each sale can be seen.

What I was hoping to do is have the subform display the sales once the user
has selected the company, month and year in the combo boxes. On the query, I
have set the criteria for these three fields to match the combo boxes on the
form.
ie: the criteria for the company field is [Forms]![Sales
Figures]![companyName]

However, I can't get the subform to refresh once the user has selected the
three filters and display the relevant data.
 
You could use the AfterUpdate event procedure of the combos to Requery the
form, i.e.:
Me.Requery

You may find it more efficient to set the form's Filter, based on whatever
combination of the boxes the user entered something in. Here's an example of
how to code that:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
 
Back
Top