By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,509 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,509 IT Pros & Developers. It's quick & easy.

Basic query question regarding parameters and grouping.

P: n/a
I often want to query the database with certain parameters in my query
which I do not want included in the query result.

The problem is when I want to group on 1, sum the 2nd (and group by)
and use a parameter on the 3rd (but don't want to group by it). For
example, I might want all records later than a certain date, but don't
want to group on the date. In the past I've made 2 queries, the first
choosing the records with the date parameter, the second doing the
grouping. I was wondering whether there was a better way.... a more
enlightened path that I could pursue...

Cheers

Reg

Jan 4 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In query design view, you have already depressed the Total icon on the
toolbar, and so you have a Total row in your query.

In the Total row under the date field, choose WHERE, and add the criteria
beneath that.

The WHERE clause is applied before grouping (i.e. only to the inital
selection process.) If you use Group By in the Total row, JET groups on the
field and applies the criteria to the total (the HAVING clause when you
switch to SQL View.)

Declaring the parameters (Parameters on Query menu) is always a good idea.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Regnab" <p.*******@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.com...
I often want to query the database with certain parameters in my query
which I do not want included in the query result.

The problem is when I want to group on 1, sum the 2nd (and group by)
and use a parameter on the 3rd (but don't want to group by it). For
example, I might want all records later than a certain date, but don't
want to group on the date. In the past I've made 2 queries, the first
choosing the records with the date parameter, the second doing the
grouping. I was wondering whether there was a better way.... a more
enlightened path that I could pursue...

Cheers

Reg

Jan 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.