Could you be more specific and give a bit more details, like examples
Printable View
Could you be more specific and give a bit more details, like examples
maybe you can code something like the following (i haven't tested this so there might be some mistakes in it, but just to give you an idea)
Code:for i = 1 to 10
if txtFields(i).Text <> "" then
if sSQLWhere = "" then
sSQLWhere = "WHERE " & txtFields(i).DataField & "= '" & txtFields(i).Text & "' "
else
sSQLWhere = sSQLWhere & "AND " & txtFields(i).DataField & "= '" & txtFields(i).Text & "' "
end if
end if
next i
sSQL = "SELECT * FROM table " & sSQLWhere
my problem is that i have about 10 fields but i need to be able to search my database for any of the fields, i.e a filter thing so it looks at what data entered to search for, then runs the search procedure taking out relevant records. This is put into a temporary file which you can look at. I can do it on principal but not in code. Thanks for your time, help and all dat.
DAVE
Hi,
I have done something similiar to what pardede suggests and it works but you have to add the logic to get out of the loop. What I did was a case statement. that checked the text boxes by priority to set the WHERE statement.
Jim