C++ equivalent of a case

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does Access/VBA have C++'s equivalent of a case function where if you have 2 checkboxes, you can say if 1 and 2 are true, execute case 1, if 1 is true and 2 is false, execute case 2

TI
infael
 
Hi Infael

Yes - check out the online help for the Select Case statement.

But, unless the situation is more complex than you've implied, I would use a
pair of If statements for this:
If Me.Checkbox1 <> 0 then
If Me.Checkbox2 <> 0 Then
' Case 1
Else
' Case 2
End If
End If

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

infael said:
Does Access/VBA have C++'s equivalent of a case function where if you have
2 checkboxes, you can say if 1 and 2 are true, execute case 1, if 1 is true
and 2 is false, execute case 2?
 
VBA certainly does have both a if..then else, and also a case statement.

however, I suspect your question is more of "when", or "how" do you get the
code to fire?

Do you want this code to run when a check box clicked on? If yes, then you
can/should use the after update event of the check box.

Feel free to elaborate on your question. Ms-access can be quite strange at
times..but I can convinced it will do what you want!
 
Back
Top