On 13 Sep 2004 10:47:21 -0700, PaulMac wrote:
I have a form with a dropdown or combo box, the user can select <All>
or pick a user name. If they pick a user name my where clause works
fine, buts what's the best way to write "Select All" if they choose
the <All>
This is what I have so far, but I don't think I should be using the
LIKE operator.
WHERE tblCase.qarep LIKE CASE @myqarep WHEN '<All>' THEN '%' ELSE
@myqarep END
and tblOffice.officecode LIKE CASE @myoffice WHEN -1 THEN '%' ELSE
@myoffice END
thanks for your help!!
Hi Paul,
You could use this:
WHERE tblCase.qarep = CASE @myqrep
WHEN '<All>' THEN tblCase.qarep
ELSE @myqrep
END
AND tblOffice.officecode = CASE @myoffice
WHEN -1 THEN tblOffice.officecode
ELSE @myoffice
END
An alternative that's a bit more work to create but that will probably
perform better is to write different versions of the query; use IF to
select which search arguments are set to All and which are set to a value
and then execute the correct version of the query.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)