ed_rollason

Select case syntax and use of wildcards

Discussion created by ed_rollason on Oct 7, 2011
Latest reply on Oct 10, 2011 by jamesfreddyc
I have a string variable (AssetID_Val) which is assigned from a previous element of code.  I want to compare the variable against some set values and assign another variable according to the value of AssetID_Val.

I assume that a select case is the best way of doing this but am not sure of the correct syntax.  I also want to introduce a wildcard character into the select case as AssetID_Val will have a variable number.

This is what I've come up with so far but it isn't working:

Select Case AssetID_Val

    Case Is = "ND_*"
    Set pStdAloneTbl = pMap2.StandaloneTable(0)

    Case Is = "LK_*"
    Set pStdAloneTbl = pMap2.StandaloneTable(1)

    Case Is = "PG_*"
    Set pStdAloneTbl = pMap2.StandaloneTable(2)

    Case Else
    MsgBox "Error"
    pEditor.AbortOperation
    Exit Sub

End Select
The * indicates a 3 digit number which will change each time.  I can't work out whether the error is with my Case syntax or with the introduction of the wildcard.  Help on both would be appreciated.


Cheers


Ed

Outcomes