3 choice buttons and if function

  • Thread starter Thread starter RobJ
  • Start date Start date
R

RobJ

Guest
hello everyone,

I made a form on which you can click 3 choice buttons. If you click one it turns black and the other two turn with.

If one of them is black you can click a button which sends you to the report which matches the choice button you selected.

What I describe now is what I want, but it doesn't seems to work.

This is the code I use:

Private Sub det_AfterUpdate()
Dim rond As Integer
Me.tot = 0
Me.lij = 0
rond = 1
End Sub

So det is one of the choicebuttons and the others are lij and tot.

If you click det it turns black and sets rond to 1. I use the code for lij and tot. Only then rond will be 2 and 3.

To get the right report I want to use a kind of if function. The only problem is I don't know how that works with 3 possibilities. With two you can use if/else.

Can someone tell me how to do it with 3 possiblities?

Hope it's clear the way I explained.

Rob
 
why not use an option group instead of 3 buttons
then use the after update event for the option group, to
select the report to print

Private Sub det_AfterUpdate() '
Dim rond As Integer

select case me.det.value
case 0

docmd.openreport RptName
case 1
docmd.openreport RptName

case 2
docmd.openreport RptName
case else
exit sub
end select
End Sub
 
this works even better, thanks a lot.

Rob
 

Users who are viewing this thread

Back
Top Bottom