DB results comparison questions

M

Martin Stabrey

I'm slowly working my way through being able to display DB results from a
user-input form which has 5 fields. My problems are these:

3 of my 5 fields are simple text fields where a user can enter any part of
what they think they may need eg. they may enter "sm" if they are not sure
if a surname if "smith" or "smyth". The results would then display all
records containing "sm". I'm not sure which comparison to use - do I use
"contains" or "like". What's the difference?
The remaining 2 of 5 fields are drop down lists where the user selection is
pre-defined. I presume I would make the comparison "equal" in this case.

Now, my biggest issue - I would like records to be returned regardless of
how many fields are filled in(obviously assuming a minimum one one field is
chosen by the user). So - as an example, if all the text entry fields are
left blank, and only one drop down item is chosen, I would like all records
that match that selection to be returned. Similarly, if two text fields are
completed, I would like all records returned that match the entry in these
two fields. There of course can also be text fields filled and drop-down
lists selected.
I have tried using "or" from the "And/or" for all of the five fields
(assuming that this is the correct choice), but records that don't match are
also returned. What am I doing wrong? Could it have something to do with the
first option in the drop down lists being left blank (ie. <option></option>)
and this is being picked up somewhere?

Any help appreciated!

Tx.

Mart
 
K

Kathleen Anderson

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top