tobybremner
03-15-2007, 05:05 AM
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
rainman89
03-15-2007, 05:59 AM
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
tobybremner
03-15-2007, 06:59 AM
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
rainman89
03-15-2007, 07:09 AM
is it a query? or a form or what?
the run categorya and b?
tobybremner
03-15-2007, 07:19 AM
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?!?
rainman89
03-15-2007, 07:26 AM
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
tobybremner
03-15-2007, 07:28 AM
run_categorya.. is just a private sub.
rainman89
03-15-2007, 08:12 AM
why not put the code from run category A in the
If [option_toggle].value=Yes Then
>CategoryA code
Else
CategoryB code
end if
tobybremner
03-15-2007, 08:15 AM
yes, I think that would be the best option. simplest solutions always seem to work best.
Thanks for all you help.