Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-05-2008, 02:26 AM   #1
Paul1979
Registered User
 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Paul1979 is on a distinguished road
Combobox filter on checkbox selection

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 is offline   Reply With Quote
Old 12-05-2008, 11:50 PM   #2
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,377
Thanks: 556
Thanked 949 Times in 898 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Combobox filter on checkbox selection

>>>There has to be another solution anyway!<<<

This post here may offer you an insight into another way of doing it, not necessarily applicable to your case. But worth knowing about I would think.
__________________
Code:
                 |||||
               @(~^~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 12-10-2008, 06:06 AM   #3
Paul1979
Registered User
 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Paul1979 is on a distinguished road
Re: Combobox filter on checkbox selection

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

Paul1979 is offline   Reply With Quote
Old 12-10-2008, 07:28 AM   #4
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,830
Thanks: 56
Thanked 1,032 Times in 998 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: Combobox filter on checkbox selection

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
gemma-the-husky is offline   Reply With Quote
Old 12-10-2008, 07:44 AM   #5
Paul1979
Registered User
 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Paul1979 is on a distinguished road
Re: Combobox filter on checkbox selection

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! :-)

Paul1979 is offline   Reply With Quote
Reply

Tags
checkbox , combobox , filter

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter records in a form using a combobox Juan Forms 7 09-21-2009 10:45 AM
Filter by selection issue jneirinckx Forms 2 09-05-2008 12:03 AM
Possible to use a combobox for both record selection and record creation? Banana Forms 10 08-20-2007 11:58 PM
Combobox : Multiple and simultaneous itme selection miguelsbpgj Forms 5 02-26-2007 01:36 PM
Combo Filter on sub form fails at last selection Ste4en Modules & VBA 0 07-10-2006 09:24 PM




All times are GMT -8. The time now is 03:24 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World