Repost: Trouble with Queries

T

Tia

The report and subreport have a query as the record source. When you open
the report/subreport, it displays all the records.

In order for us to use it in the office, we need to pull records according
to weeks. So we created filters and saved them as queries, which we apply to
the report. These work except they need to filter data according to
Employee, Week, and Service type. I can get the filter to sort the Employee
and week and the service in the actual query but when I apply it to the form,
it doesn't distinguish the service type and displays all records for that
week, regardless of type of service.

Am I doing something way wrong??? Any suggestions, would be greatly
appreciated!! Thanks!
 
J

Jackie L

Why not just base your form off a query, with the criteria listed and not use
the filter? You can refer to your form or data entry in the criteria line of
the query and add a DoCmd.Requery to an event on your form to regenerate the
data.
 
T

Tia

Thanks for the idea. I'm just not sure how it would work. The form is used
to apply a filter to the query.

If you press the button, week 1, it opens the query with the filter week 1
applied. There's buttons 1-4 for each week in the month.

Would I need to create a query for each of the weeks? How would I apply the
same report to all of those???

I apologize for all the questions, but I'm at a loss on how to work around
this problem and I think your idea may be workable. Thanks for your
suggestion!
 
J

Jackie L

Tia,
I am not sure how your "week 1" applies to actual dates so you will have do
adapt my suggestion accordingly, but what I would do if you want to continue
to use the four buttons, put a hidden field (Week Choice) on the form with
the four buttons, on the On Click event of the button Week 1, put

Me.WeekChoice = "Week 1"
DoCmd.OpenForm "frmWhateverTheFormNameIs"

Then, if your form is based off a query that has the field WeekChoice in the
criteria, you will only be using one query, one form for different results.

Let me know if this helps or if you need anything further.
Jackie :eek:)
 
Top