If...Then...Else

K

Kim

Good Afternoon!
I have a form that will pull up several reports. On the left side of the
form I have an option group with 3 options and on the right side of the form
I have 3 buttons.

The user chooses an option (Children, teachers, Aides) and will click a
button on the right side of the for to pull up a specific report (attendance,
classes, paperwork). Each combination pulls up a different report. i'm having
some difficulty getting an if then statement to work. Can someone show me an
example? Or, is thre another way to do this so it will work properly? Thanks
for the help!!!
 
B

Barry Gilbert

I prefer Select Case to If/Then, but either will work.

In each button, there are three possible reports, based on the option group.
In each button click event, put something like:
Select Case Me.MyOptionGroup
Case 0
DoCmd.OpenReport "rptChildrenAttendance"
Case 1
DoCmd.OpenReport "rptChildrenClasses"
Case 2
DoCmd.OpenReport "rptChildrenPaperwork"
End Select

Barry
 
N

niuginikiwi

You can do as Barry suggested or else you can stack the 3 buttons on top of
each other put a procedure on the afterupdate event of your option group to
control the visibility of your 3 buttons. Then you can enable or disable the
visibility of each buttons depending on the the options you select.
And have each button print each report as normal that can be easily done
from the wizzard.
 
K

Kim

It worked perfectly, thanks Barry!

Barry Gilbert said:
I prefer Select Case to If/Then, but either will work.

In each button, there are three possible reports, based on the option group.
In each button click event, put something like:
Select Case Me.MyOptionGroup
Case 0
DoCmd.OpenReport "rptChildrenAttendance"
Case 1
DoCmd.OpenReport "rptChildrenClasses"
Case 2
DoCmd.OpenReport "rptChildrenPaperwork"
End Select

Barry
 
Top