Posted by Ed Murphy on 05/10/07 15:02
Looch wrote:
> I have a three text boxes in a VB app that I want to use as criteria
> for a query.
>
> txt1 = Serial Number
> txt2 = Ship Date
> txt3 = Item Description
>
> All three item attributes (txt1 - 3) are columns in table that
> includes much more information (Customer Name, Address, etc). Granted
> this isn't ideally following the relationtional model.
>
> If the user knows the Serial Number, that will return one record which
> would be great. If they know only the Item Description that may return
> 100 records. If they know the Item Description and Ship Date that may
> narrow it down to 25 records. I don't want to require txt1 - 3 be
> included in the query but if the information is available than it
> would be used in the query to help narrow down the search.
select <columns>
from <table>
where (@sn is null or sn = @sn)
and (@sd is null or sd = @sd)
and (@desc is null or desc = @desc)
Navigation:
[Reply to this message]
|