Two Text Boxes Filtering the Same Combo Box (1 Viewer)

themurph2000

Fat, drunk, and stupid
Local time
Today, 11:42
Joined
Sep 24, 2007
Messages
181
This qualifies under the "dumb question or one that's been answered a million times but I can't find it" section...

I created a form with a combo box in the header for the purpose of selecting a specific record. I want to synch up the combo box with a text box so that someone types a person's ID on the list to have it come up in the combo box. OK, that part isn't difficult. But can the same combo box be used to ALSO filter by the last name of the person? I was tempted to use the SQL statment to do an OR criteria, but wouldn't that show all records, since the text box you don't use would be a blank?

Just curious to see what people think.
 
Local time
Today, 11:42
Joined
Mar 4, 2008
Messages
3,856
I do this in one of my combo boxes. I use a select statement like:
select ID, name from
(
select ID, fname & lname as name from people
union
select ID, lname & ', ' & fname as name from people
)
where mycriteria = true;

Another option I use is getting the names and IDs from an alias table, which seems to run much faster and makes it easier to filter (only 1 set of criteria).
 

Users who are viewing this thread

Top Bottom