Run command based on Option Button

tobybremner

noddy
Local time
Today, 02:14
Joined
Jan 17, 2007
Messages
11
Hi,

Very new to all this.

I am trying to run a procedure to say that if an option button is true (checked) then run one command if the option button is false (unchecked) then run a different command.

I understand this is probably a very basic request, but we all have to start somehwere!

Thanks in advance
 
I would put a button taht checks to see if the option is yes/no
in the onclick of that button put

If [option_toggle].value=Yes Then
Docmd..... whatever u want run if yes
else
Docmd..... whatever u want run if not yes
end if
 
What would I put after Docmd if i have a command called "run_categorya" if yes and "run_categoryb" is no, highlighted in red?

Sorry im not the best vber

If [option_toggle].value=Yes Then
Docmd..... "run_categorya". else
Docmd..... "run_categoryb".
end if
 
is it a query? or a form or what?
the run categorya and b?
 
Basically I have a form with loads of comboboxes and check boxes, when certain items and checkboxes are ticked I then have a button which runs vb code called "run_categorya", which runs a query based on a table of data, filtering on the items selected.

What I want to do is have an option box to chose between running data a certain way or the other, "run_categorya" or other vb code "run_categoryb". So when I press the filter button, there is a peice of code that see that the option is checked and runs either vb code.

Does that make sense?!?
 
I think you are looking for a

Docmd.RunSQL "run_categorya" if that is infact an sql code.

or if it is saved as a query.

Docmd.OpenQuery "run_categorya"

not sure what one u are looking for. if u wanna post a sample db im sure someone will have a look
 
why not put the code from run category A in the

If [option_toggle].value=Yes Then
>CategoryA code
Else
CategoryB code
end if
 
yes, I think that would be the best option. simplest solutions always seem to work best.

Thanks for all you help.
 

Users who are viewing this thread

Back
Top Bottom