ai3rules
03-10-2005, 12:36 PM
I have 4 select menu's and a text box. I will be using those for an advanced search feature on my site. So, that means that the user has the ability to choose 1, 2, 3, 4 or 5 ways of searching in any combination.
The way I have been doing it until now is programming for every scenario. For example:
IF agent <> "" AND os <> "" AND whatDay <> "" AND strSearch <> "" THEN
Recordset1.Source = "SELECT * From queryAll " _
& "WHERE Agent LIKE '%" & Replace(agent, "'", "''") & "%' "_
& "AND OS LIKE '%" & Replace(os, "'", "''") & "%' "_
& "AND Day LIKE '%" & Replace(whatDay, "'", "''") & "%' "_
& "AND LastName LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY Machines.MachineName;"
END IF
I am doing that for every possible scenario. I am wondering, is there an easier way to do this?
I appreciate any help,
Thank you.
The way I have been doing it until now is programming for every scenario. For example:
IF agent <> "" AND os <> "" AND whatDay <> "" AND strSearch <> "" THEN
Recordset1.Source = "SELECT * From queryAll " _
& "WHERE Agent LIKE '%" & Replace(agent, "'", "''") & "%' "_
& "AND OS LIKE '%" & Replace(os, "'", "''") & "%' "_
& "AND Day LIKE '%" & Replace(whatDay, "'", "''") & "%' "_
& "AND LastName LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY Machines.MachineName;"
END IF
I am doing that for every possible scenario. I am wondering, is there an easier way to do this?
I appreciate any help,
Thank you.