Filter Form with Option Buttons

ppete

Registered User.
Local time
Today, 20:13
Joined
Jan 15, 2002
Messages
27
Hi All,

Just wondered if anyone can help me with this.

I have a form based on a query that has 16 options for values in one of the fields. I wanted to put an option button for each value on a form that would allow the user to view the records based on which option buttons were selected and have the form update accordingly.

The way I've gone about it is to have some code in the after_update event thingimy of each option button that updates a boolean value in a table that's linked to the underlying query the form is based on - but this just seems a long way to go about this... plus it's not working...

I've searched the archives for clues on this but haven't come up with anything. So I just wondered, is there a better way than what I'm doing. I'm not after somebody to do this for me, just point me in the right direction.

Many thanks,

Peter
 
Make a textbox and set its Visible-property on False so that it's hidden.

Now, create your buttons and for each button, create an OnClick-event. Make it so that when a user pushes the button, access updates the hidden textfield with the value of your choosing. Then requery the form. Make sure your query contains a condition that refers to this hidden field (ie [Forms]![Form1]![txtHidden])

Button code:

Sub Button1_Click()
Me.txtHidden.Value = "Option1"
Me.Requery
End Sub

PS : Forget the option-buttons, they're not good for this. Use regular buttons.

Greetz!

Seth
 
Thanks for that Seth,

That's a simpler solution, the only prop is that this doesn't allow the user to turn certain options off. But it's put me on the right track so thanks for that. I'm going to look at using a toggle buttons.

Cheers,

Peter
 
Ah I see! You'd like the options to be turned on or off. In that case, those option-buttons do seem like a good idea maybe.

Anyhow, I hope you're back on track now! :-)

Greetz,

Seth
 

Users who are viewing this thread

Back
Top Bottom