Expression in sorting and grouping

G

Guest

I have a query that has 4 different itemtypes three of these types I use in
the heading of my report, the 4 type "m" can have multiple records and I want
to show only the type M in the detail section. I've been trying to use an
expression in the sorting and grouping Itemtype = M but it gives me a prompt
which I don't want. Is there a way to do this in the sorting and grouping or
do I need to do it some other place.
Thanks for any help
 
D

Duane Hookom

Sorting and Grouping is for applying an order/sequence to your records. From
your description, it sounds like you want to filter the records. If you want
to filter, add a where clause to the DoCmd.OpenReport line of code:

Assuming you have a command button on your form that opens the report. Add a
check box to the form "chkOnlyM". Your code might look something like:

Dim strWhere as String
If Me.chkOnlyM = True Then
strWhere = "[ItemType]='M' "
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
 
G

Guest

Thanks that will work.


Duane Hookom said:
Sorting and Grouping is for applying an order/sequence to your records. From
your description, it sounds like you want to filter the records. If you want
to filter, add a where clause to the DoCmd.OpenReport line of code:

Assuming you have a command button on your form that opens the report. Add a
check box to the form "chkOnlyM". Your code might look something like:

Dim strWhere as String
If Me.chkOnlyM = True Then
strWhere = "[ItemType]='M' "
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere

--
Duane Hookom
MS Access MVP


CD Tom said:
I have a query that has 4 different itemtypes three of these types I use in
the heading of my report, the 4 type "m" can have multiple records and I
want
to show only the type M in the detail section. I've been trying to use an
expression in the sorting and grouping Itemtype = M but it gives me a
prompt
which I don't want. Is there a way to do this in the sorting and grouping
or
do I need to do it some other place.
Thanks for any help
 

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

Top