Filter and WHERE condition for 2 similar reports

G

Guest

I have 2 similar reports which are requisition orders.
Report "POR" is a report that displays Order and OrderDetails information,
report "POR_Thread" is the same form but has the addition of after every
order detail it displays thread information (if the category ID is thread). I
have one cmd button on my main orders form that links to view reports in
Print Preview.

When my subform Category control = 1 (thread), I want the report
"POR_Thread" to display the information and to be filtered by just the
"PurchaseOrderNo" displayed in the main form (i haven't set up a filter yet
so if needed I'd like to be told how to do that as well).

If my Category control = 2, 3 or 4 I want the report "POR" to display the
information
 
M

Marshall Barton

WoodyAccess said:
I have 2 similar reports which are requisition orders.
Report "POR" is a report that displays Order and OrderDetails information,
report "POR_Thread" is the same form but has the addition of after every
order detail it displays thread information (if the category ID is thread). I
have one cmd button on my main orders form that links to view reports in
Print Preview.

When my subform Category control = 1 (thread), I want the report
"POR_Thread" to display the information and to be filtered by just the
"PurchaseOrderNo" displayed in the main form (i haven't set up a filter yet
so if needed I'd like to be told how to do that as well).

If my Category control = 2, 3 or 4 I want the report "POR" to display the
information


The code behind the command button (on your subform?) that
you use to run the report could use this kind of logic:

Dim stDoc As String
Dim stWhere As String

stWhere = "Category=" & Me.Category
If Me.Category = 1 Then
stDoc = "POR_Thread"
Else
stDoc = "POR"
End If
DoCmd.OpenReport stDoc, acPreview, , stWhere
 

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