Select Case statement is appropriate when you want to compare one expression to a series of values. Because the expression is evaluated only once, then cached and then compared to the values, it is faster than a long series of if ... elseif ... end if.
The syntax is quite simple:
Select Case (expression)
Case (Value1)
(Statements)
Case (Value1)
(Statements)
Case (Value1)
(Statements)
Case Else
(Statements)
End Select
In your case, it should look like:
If Button = vbRightButton then
Select Case Index
Case 0
me.PopupMenu menu0
Case 1
me.PopupMenu menu1
Case 2
me.PopupMenu menu2
Case Else
MsgBox "Error"
End Select
End If
Main Topics
Browse All Topics





by: admillerPosted on 1999-06-17 at 16:27:59ID: 1494629
Let me know if you need a further explanation on this question. Perhaps I could send a diagram?
admiller