Select Case troubles

Results 1 to 3 of 3

Thread: Select Case troubles

  1. #1
    Kentium Guest

    Default Select Case troubles

    I have a variable- whichTables that has a value of 2;1;7;4;8;9;10;11<BR><BR>I would like to do a select case scenario like this-<BR><BR>Select Case whichTables<BR> case instr(whichTables, "7")<BR>do some stuff<BR> case else<BR>end Select<BR><BR>For some reason, i&#039;m not getting a match when 7 is in whichTables.<BR><BR>Any ideas why?<BR><BR>Thanks!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Select Case troubles

    myint = InStr(...)<BR><BR>Select Case myint<BR> Case 1:<BR> do some stuff

  3. #3
    Join Date
    Dec 1969

    Default Undestanding Select Case

    When you code<BR><BR>Select Case expression<BR><BR>then VBS (and most every other language that has a similar construct) looks for the following case that *matches the value* of that expression.<BR><BR>When you do<BR><BR>Select Case "1;4;7;10"<BR><BR>then the *only* subsequent Case that *can* match that is:<BR><BR>Case "1;4;7;10"<BR><BR>You *really* want IF...ELSEIF...ELSEIF...ELSEIF...ELSE...END IF in these circumstances. You do *not* want Select Case.<BR><BR>(Note the lack of a space in "ELSEIF".)<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts