I'm trying to create a search form. The backend SQL table I need to search is partly denormalized. It contains 2 person name fields, something like [SalesmanName] and [ManagerName]. I have a union query which generates a list of all names (without dupes) including Salesmen and Managers because I don't care which of the two fileds contains the name being searched for. The user selects a name from a unbound combobox which has the union query as it's row source.
The code for my search form sets a RecordSource as in the following common example:
Me.RecordSource = "SELECT * FROM qrySearch " & BuildFilter
If I want to construct BuildFilter as a "Like" clause, that's a piece of cake. There are a number of examples that show how to do that. However, I want to construct a BuildFilter with an equality ("="), and also using "or" operator? In pseudo-code, that looks like the following:
"If the comboxbox value is not blank find rows where [SalesmanName] equals the combox value OR [ManagerName] equals the comboxbox value"
I'm stuck on constructing that statement. All my attempts at that syntax are blowing up with compile errors or syntax errors. Can you help me out? I would greatly appreciate it!