Hi Guys

I have a List Box ("LISTJOBTYPE") and so the User can select more than one Item:

Junior Stylist
Hair Stylist
Senior Stylist
Principle Stylist

In my database I have the following:

APP_NAME Jack APP_JOBTYPE Hair Stylist, Senior Stylist
APP_NAME Jill APP_JOBTYPE Hair Stylist

This is my SQL:

SQL = "SELECT APP_NAME, APP_JOBTYPE FROM TBLAPPLICANTS WHERE APP_JOBTYPE
LIKE '%" & Request.QueryString ("LISTJOBTYPE") & "%

If I select Hair Stylist in the List Box I get: Jack,Jill

If I select Hair Stylist and Senior Stylist in the List Box I get: Jack

The thing is I want it to work so that any instance of Hair Stylist would
bring up both records.

So that if I select Hair Stylist and Senior Stylist in the List Box I would get: Jack,Jill

Any help would be good

Hi,

you can use following method.

dim arrval, strwhere
if instr(Request.QueryString ("LISTJOBTYPE"),",") <> 0 then
arrval = split(Request.QueryString ("LISTJOBTYPE"),",")
strwhere = "APP_JOBTYPE LIKE '%" & arrval(0) & "%' or APP_JOBTYPE LIKE '%" & arrval(1) & "%'"
else
arrval = Request.QueryString ("LISTJOBTYPE")
strwhere = "APP_JOBTYPE LIKE '%" & arrval & "%' "
end if

SQL = "SELECT APP_NAME, APP_JOBTYPE FROM TBLAPPLICANTS WHERE "&strwhere

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.