option group and command button

  • Thread starter Thread starter Andy Yang
  • Start date Start date
A

Andy Yang

I want to have an option group, and depending on which option is
selected, i want to hit a command button to go to a form.
in other words, let's say i have an option group, and each option is a
title of a certain form (or report). after selecting my desired form/
report in the option group, i want to hit a command button to take me
to that desired form/report.

Is there any way to do this without using VB? help would be much
appreciated!

andy
 
I want to have an option group, and depending on which option is
selected, i want to hit a command button to go to a form.
in other words, let's say i have an option group, and each option is a
title of a certain form (or report). after selecting my desired form/
report in the option group, i want to hit a command button to take me
to that desired form/report.

Is there any way to do this without using VB? help would be much
appreciated!

andy

Without using code? No.

With code....
Code the Command button's Click event:

Dim strForm as String
strForm = Choose([OptionGroupName],"Report1","Report2","Report3")
DoCmd.OpenForm strForm

The above assumes the Option Group has 3 choices, with a value of 1,
2, or 3.
 
It can be done without VBA, but I would strongly suggest you expend the
effort to learn it. It makes it easier for you to create more robust
applications.
You can use a Macro with conditions. You would set the condition based on
the value of the option group:

Condition Action

Forms!RptSelector!opgReport = 1 OpenReport
Forms!RptSelector!opgReport = 2 OpenReport
Forms!RptSelector!opgReport = 3 OpenReport

Then for each Action you would enter the name of the report.
 
Back
Top