How To Build a Combo Box as a Data Filter

  • Thread starter Thread starter straylight via AccessMonster.com
  • Start date Start date
S

straylight via AccessMonster.com

I would like to think I am a pretty resourceful guy, but this is driving me
crazy.

In short, I need to use a combo box as a data filter, unfortunately this is
harder than it sounds for the self initiated.

I have been writing access databases for several people the past year, taking
what I learn here and there, but this tutorial "
http://www.databasejournal.com/features/msaccess/article.php/1487531" has
confounded me.

It is exactly what i need to put in my database but it doesnt make sense.
Its posted verbatim all over the web yet no one ever mentions it.

Specifically- step 4 regarding making the qry and joining it to other tables..
.. i guess i need more detail.

If this is too wordy I'm sorry, :)

-straylight
 
Hi,



The combo box ROWSOURCE property must have the possible choices. Something
like

SELECT DISTINCT clientName, clientID FROM clients


Since, here, two fields are selected, the number of columns should be set to
2. You can hide the ClientID specifying a column width of 0 for the second
column, if this is desirable.

You can also specify that the combo box can only accept data in the list.

In the AfterUpdate event of the combo box (not the AfterUpdate event of the
form), you can use:

Me.Filter="ClientID=" & Me.ComboBoxName.Column(1)
Me.FilterOn = true


Note that we have two columns, in the combo box, but we start counting them
at 0. So, Column(1) refers to our second column (the clientID associated
with the clientName the end user could have see).


The reference you supplied does not have a "step 4" as you described it.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top