dianemarie
Instructor
Hello, we have quite a few reports where the selection criteria is determined by the user via a parameter. In an earlier post I was shown how to use the Select Case in the Where part of the query to reference the parameter. It works well. However, our reports are very flexible and we often have several selection criteria parameters. When I add the second Select Case statement, the query returns an error. What I am using is below, with the parameter being @Salesman, and the oh.salesman and oh.listdiv fields being chars. Does anyone see an obvious mistake? Also, if you create reports that allow users to manipulate the select criteria via a parameter, do you do it differently? Thanks for any help, I know I've been needy!
CASE @Salesman
When 'X24' then oh.salesman not in ('24','07')
When '24' then oh.salesman = '24'
When 'C' then oh.listdiv = 'C' else ' '
End) as Slsman
CASE @Salesman
When 'X24' then oh.salesman not in ('24','07')
When '24' then oh.salesman = '24'
When 'C' then oh.listdiv = 'C' else ' '
End) as Slsman