Combobox filter on checkbox selection (1 Viewer)

Paul1979

New member
Local time
Today, 16:57
Joined
Dec 5, 2008
Messages
3
I've got something really weird and I can't seem to figure out what to do about it.

My database is about Marine Research Institutes in Europe. You can imagine that an institute in Norway doesn't do research on the Black Sea, so I've added a number of checkboxes (Baltic Sea, North Sea, Black Sea, etc.) that store their Yes/No data in the main form. On this same main form I have an unbound combobox with a Value List that corresponds to the checkbox-values. This filters for records in which one of the checkboxes is checked. This all works! At least... when I set the Bound Column property to 0.

At the same time I have given the combobox a standard value "Select Water Basin here" when it is not selected. In the 'On Enter' event this standard value should disappear and a dropdown list is shown with the different Water Basins to select for my filter query. In the 'On Exit' event the "Select Water Basin here" value should return. This all works too! At least... when I set the Bound Column property to 1.

Now here comes the tricky part:
I want both things to work at the same time! When the 'Bound Column' property is set to 0, the filter function works, but the stand value/refresh function doesn't. And when the 'Bound Column' property is set to 1, it's exactly the other way around. I can't figure out what's causing this. I tried flipping the 'Bound Column' property in VBA, but I couldn't get this to work. There has to be another solution anyway!

I hope someone out there is able to help me on my quest! :)

Thanks heaps!

Paul
 

Paul1979

New member
Local time
Today, 16:57
Joined
Dec 5, 2008
Messages
3
Thanks UG!

I had a look at the link you posted. Didn't help me very much on my own problem, but gave me some nice new insights for possible future modifications of my own DB. :) A couple of good nights' sleep however gave me the inspiration for my 'Eureka' moment:

I added some code to the "MyComboBox_Enter" and "MyComboBox_Exit" Events:

-----------------------------
Private Sub MyComboBox1_Enter()
Me.MyComboBox1.BoundColumn = 0
End Sub
-----------------------------
Private Sub MyComboBox1_Exit(Cancel As Integer)
Me.MyComboBox1.BoundColumn = 1
End Sub
-----------------------------

This completely did the trick!

Much obliged, couldn't have done it without ya! ;-)

Paul
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:57
Joined
Sep 12, 2006
Messages
15,640
i dont quite understand how you are trying to use the cbobox

but cant you have two cboboxes, and hide/show them as appropriate - even making the lookup dependent on a third (hidden) text box maybe, taking its value from whichever combo box is currently available/active
 

Paul1979

New member
Local time
Today, 16:57
Joined
Dec 5, 2008
Messages
3
The combobox works as filter. It shows a value list corresponding to the titles of a series of checkboxes on the same form. I linked them with the "Select Case" statement.
Having two overlapping comboboxes would work, but I thought doing it with one would look more organized for myself if I'm in Design View again.

I just figured out today what was missing in my code and now it works like a charm! (see previous post)

Thanks anyway! :)
 

Users who are viewing this thread

Top Bottom