Select Case and Enumerations: Intellisense fails

  • Thread starter Thread starter kiln
  • Start date Start date
K

kiln

Having defined an enumeration, the VBA editor in Access 2000 shows the
enumerations in an If...End If statement. But I can't get the enum to
appear in a Select Case statement. Why? Dumb example but anyways...

Public Enum NiceNames
nnBilly
nnHank
nnJoan
End Enum

Public Function SayAName(pintIndex as Integer)
' The enum is shown as I type this If...End If
If pintIndex = nnJoan Then
MsgBox "Joan"
End If

' The enum values are not presented by intellisense after typing
the Case line.
Select Case pintIndex
Case nJoan
MsgBox "Joan"
End Select

End Function
 
Hi kiln,

I wouldn't expect anything to show the intellisense when you've declared
pintIndex as integer (in the funciton header). When you change it to:

Public Function SayAName(pintIndex as NiceNames)

I would expect intellisense to work (showing only the 3 choices in your
enum). Regrettably, I can duplicate that in the select case, it does not
limit the list to only the enum options. I don't know why!
 
Hi Sandra

That was a typo on my part... the real code has it correctly.

I wasn't sure, did you mean to say that you confirm the fact that
intellisense doesn't work with the enum at all in Select Case; or rather
that you can add an ad hoc value where you might not expect to be able
to. On my end, I can't get the intellisense to work at all with an enum
as in
Case nnJoan

Thanks
 
I meant that it doesn't work at all with the select case. For example, using
your first example as I type "if pintIndex =" I immediately get a list of
the enum values and nothing else.

Yet if I type the Select case statement, after the first Case there is no
immediate intellisense dropdown. I can hit Ctl-Spacebar and get the full
list of properties, methods and variables and it will eventually scroll down
to the enum values but only as I type more characters.

I hope that makes more sense!
 
OK, well, not what I wanted to have confirmed... I suppose it's an
oversight by the Access group? Can't imagine why it shouldn't be working
other than that.
 
Back
Top