Access 97 Query Question

  • Thread starter Thread starter Aly
  • Start date Start date
A

Aly

I'm running into a problem with a query and I hope someone
can help me.

I need for a query to total the occurances of a defect
code for a type of test on 1-month, 3-month, 6-month,
basis. When I run a query to give me the countOfDefectCode
I get a count of the # of x's that code appeared each day.
Do I need to create a subquery to be able to give me a
count of the codes by month, 3=month, 6-month, etc.?
Thanks, Aly
 
Aly,

The best way to do this is to use a report. The grouping
funcionality of dates in a report will allow you to group by
quarter.

Gary Miller
 
Using a report is definitely better than simply running a query for more
than the reasons given ...

The simplest answer to Aly's question is to use a parameter query. All you
need to do is enter something like the following into the criteria line for
the date:

Like Between [Enter Beginning Date] and [Enter Ending Date]

Each time you run the query you will be prompted for both dates.

Personally, I never let an end user see the raw results of a query. Nor do
I use query prompts like the above. [He says with a sniff and his nose in
the air] :-))

I use a preparatory form that I call a "Launcher" for related families of
reports and for those that require parameters. Once the relevant controls
are filled a command button is clicked that runs the selected Report(s).
(Could be a query). Since the form is still open, the query in the
Report(s) can refer to controls on the form. That is a much smoother
process than bombarding your user with a succession of prompts.

Another thing I do on just about every text box that requires a date is to
allow keyboard entry of a date or, on doubleclick, open a graphic calendar
that opens with today's date selected and that allows clicking to the proper
year and month. Doubleclicking the day returns that date to the textbox and
closes the calendar.

The calendar and supporting code that I use is one from Ken Getz from the
Access 2 Developer's Handbook. He includes an example calendar and code on
the CD with each release of the handbook. If you don't have the Developer's
Handbook, there is a downloadable calendar available from Pedro Gil via
http://mvps.org/access click "Search" and enter "calendar". I believe
Tony Toews has some downloadable calendars on his site as well.

hth
 
Back
Top