Friday, October 19, 2007

Adding an Option for (All) to Combo Boxes or List Boxes

How do I get my combo box to show an option for "All"?

This is a pretty common question on the discussion boards.

Look around the net and you'll see one common technique for "adding to your combo box". this post at the Access Web shows you how to do it using a union query, which is the solution I've used pretty reliably.

But here's another way. This "visual how-to" on MSDN shows you how to exploit a (AFAIK) rarely discussed approach to combo boxes where a callback function provides the rows. (This "function as a row source" thing is really neat and I hope to do another post on it soon!) This approach may be overkill for most combo box scenarios. It is, IMHO, pretty elegant though. And I'm pretty sure it's more flexible too. And I think it's worth a read just to get a look at the combo box rowsource callback function.

The article discusses Access 2007, but I did the same thing in 2003 and it works just the same.

No comments: