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.
Ed
Ed,If the first 3 characters are what you are interested in searching, meaning that anything before the _underscore is what you want to match, then you could just set a new string variable to the first 3 characters and run your Select Case on that. This would mean that you are only looking to Select the first 3 chars (rather than attempting the wildcard, which I don't think will work).Something like this:
Dim AssetID_Val As String = "PG_123" 'this is manually set to test it out
Dim srchString As String = Mid(AssetID_Val, 1, 3)
Select Case srchString
Case "ND_"
MsgBox(AssetID_Val & " Found!")
Case "LK_"
MsgBox(AssetID_Val & " Found!")
Case "PG_"
MsgBox(AssetID_Val & " Found!")
Case Else
MsgBox("nothing found!")
End Select
So, in the above example, the MsgBox would popup "PG_123 Found!" because the Select located that the first 3 characters in the AssetID_Val variable are "PG_". If the AssetID_Val was = "LK_888888", then the msgBox would popul with "LK_888888 Found".Hope this makes sense!Here's how your full implementation might look:
Dim srchString As String = Mid(AssetID_Val, 1, 3)
Select Case srchString
Case "ND_"
Set pStdAloneTbl = pMap2.StandaloneTable(0)
Case "LK_"
Set pStdAloneTbl = pMap2.StandaloneTable(1)
Case "PG_"
Set pStdAloneTbl = pMap2.StandaloneTable(2)
Case Else
MsgBox "Error"
pEditor.AbortOperation
Exit Sub
End Select