Radio Buttons?? or Option Buttons??

John64

Registered User.
Local time
Today, 00:02
Joined
Apr 30, 2009
Messages
69
I have a form that is linked to a query which is able to update my ID field based on a text box. There is a chart in this form that then graphs this data. There are 3 fields of data that can be charted. I would like to have the option to turn some of these off and on from the form, preferably with radio buttons. I am unable to figure out the criteria necessary to toggle the "show" of a query field on and off. It is the equivalent of clicking the show checkbox in the query builder. What criteria do I need to type? Thankyou.
 
I can't think of any criteria you can type. The checkbox you describe controls whether the field shows up in the SELECT clause in SQL view. I suspect you'll have to build your query in code, changing what's in the SELECT clause based on your form selections.
 
Do you have any idea how I would go about doing that? I am not real familiar with editing SQL?
 
Writing code like this in SQL is going to be extremely difficult for me. I am just not that familiar with the SQL language.

If anyone happens to know an easy way to link radio buttons to the selection of the query criteria please let me know. Also if anyone has an example of working radio buttons of any type, that would be helpful in stepping me in the right direction. Thank You
 
well a radio button is either on or off - true or false

so what you really want to do, is get a query, and match a yesno field in the query to the yesno radio button

then you can just pick the field, and in the criteria row, have

=forms!myform!myradiobutton

then if the radio button is set (true), the query will only pick the true values etc.
if its false, you will only get the false values.

this can be expanded to cover several yesno buttons.

------------
hopefully this sort of idea should help you get started.


---------
note the difference between several radio buttons, and an OPTION GROUP is that the latter only allows 1 item to be selected. These are not yesno fields, but selection ranges, then used in a similar way

eg, an option group could select between petrol engines and diesel engines, and hybrid engines. An option group is similar really to a combo or list box - its often just a matter of taste as to your favoured presentation
 
Dave, I think the goal is not to restrict records but to change which field is returned by the query. I don't see that being possible with criteria. In other words, sometimes I want "SELECT FieldA..." and sometimes I want "SELECT FieldB...".
 
yep

fair comment

[edited for clarity]
i think i might do this, by providing 3 different predetermined solutions, and use the option group to pick the appropriate solution then - maybe easier than trying to do anything too fancy - just get a slightly bigger dbs

so

if optiona then openform "solution_a"
if optionb then openform "solution_b"
if optionc then openform "solution_c"
 
Last edited:
Thanks for the help it looks like this is going to be much more difficult than I thought. Pbaldy understands the problem well. I don't believe it will be possible with an options group. Not quite sure how I will be able to create a yes/no field of my data in the query either. I will have to look at this on friday when I get back. Thanks again.
 
Dave's option would probably work. It would involve having 3 queries, each selecting the relevant field(s), and switching which one is used based on the option group. We'd probably need to know more about what you're doing to suggest the best solution.
 

Users who are viewing this thread

Back
Top Bottom