Windows Vista Forums

select case does not work ... why?

  1. #1


    Albert Andersson Guest

    select case does not work ... why?

    Hello

    I have a Select Case statement with 3 cases and the else statement.

    case 1 and 2 works fine but 3 not. And this even if i put the same code
    like 1 or 2 in it.
    Maybe Switch /case just dont work the way like i'm used from C#.

    also when i create a if elseif elsfif else statement only the first
    elseif seems to work, the secont not.

    my Code runs in a aps site and the variable im looking for is a url
    parameter.

    Dim param
    param = Request("Param")

    My case looks like This:

    select case param
    case "1":
    'code a
    case "2":
    'code b
    case "3":
    'code b
    case else
    'code d
    end select

    the if elseif statement looks like this:



    if param = "1" then
    'code a
    elseif param = "2" then
    'code b
    elseif param = "3" then
    'code b
    else
    'code c
    end if

    1,2,3 are actually the real values, since they represent type-codes.

    may be there are some strange restrictions i dont know about.
    As you see in 2 and 3 runs actually the same code ... so i really dont
    know whats the matter.

    Is there no way to debugg VBA on IIS? I installed the scriptconsole,
    activated debugging opened the site in te script debugger (MS) but
    nothing happens.

    Here the real CODE:

    Select Case notification_type
    Case "1":
    ' Accepted Job applications submitted within the last 7 days (until
    last midnight)
    submission_date_from = DateAdd("d", -6, submission_date_to)
    status = 3
    range_text = "between " & submission_date_from & " and " &
    submission_date_to
    subject = "Accepted Job Applications Submitted " & range_text
    no_applications_text = "There are no accepted job applications that
    were submitted " & range_text & "."
    Case "2":
    ' Accepted Job applications submitted within the last 30 days (until
    last midnight)
    submission_date_from = DateAdd("d", -29, submission_date_to)
    status = 3
    range_text = "between " & submission_date_from & " and " &
    submission_date_to
    subject = "Accepted Job Applications Submitted " & range_text
    no_applications_text = "There are no accepted job applications that
    were submitted " & range_text & "."
    Case "3":
    ' Accepted Job applications submitted within the last 30 days (until
    last midnight)
    submission_date_from = DateAdd("d", -29, submission_date_to)
    status = 3
    range_text = "between " & submission_date_from & " and " &
    submission_date_to
    subject = "Accepted Job Applications Submitted " & range_text
    no_applications_text = "There are no accepted job applications that
    were submitted " & range_text & "."
    Case Else
    ' All job applications submitted yesterday
    submission_date_from = submission_date_to
    range_text = "on " & submission_date_from
    subject = "Job Applications Submitted " & range_text
    no_applications_text = "No job applications were submitted " &
    range_text & "."
    End Select


    mfg
    Albert

      My System SpecsSystem Spec

  2. #2


    Albert Andersson Guest

    Re: select case does not work ... why?

    Event if i write it like this it does not work. So what is wrong with
    "3" doen't make any sense:

    If notification_type = "1" Then
    ' Accepted Job applications submitted within the last 7 days (until
    last midnight)
    submission_date_from = DateAdd("d", -6, submission_date_to)
    status = 3
    range_text = "between " & submission_date_from & " and " &
    submission_date_to
    subject = "Accepted Job Applications Submitted " & range_text
    no_applications_text = "There are no accepted job applications that
    were submitted " & range_text & "."
    End If
    If notification_type = "2" Then
    ' Accepted Job applications submitted within the last 30 days (until
    last midnight)
    submission_date_from = DateAdd("d", -29, submission_date_to)
    status = 3
    range_text = "between " & submission_date_from & " and " &
    submission_date_to
    subject = "Accepted Job Applications Submitted " & range_text
    no_applications_text = "There are no accepted job applications that
    were submitted " & range_text & "."
    End If
    If notification_type = "3" Then
    ' Accepted Job applications submitted within the last 30 days (until
    last midnight)
    submission_date_from = DateAdd("d", -15, submission_date_to)
    status = 3
    range_text = "between " & submission_date_from & " and " &
    submission_date_to
    subject = "Accepted Job Applications Submitted " & range_text
    no_applications_text = "There are no accepted job applications that
    were submitted " & range_text & "."
    End If

      My System SpecsSystem Spec

select case does not work ... why?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script that uses the DatePart & Case select David Rodriguez VB Script 0 16 Jul 2009
Logon script - function array and select case not working Nex6 VB Script 6 09 Jun 2009
Re: Select case question Pegasus [MVP] VB Script 2 19 Apr 2009
Case/Select functionality LoneWolf PowerShell 7 25 Feb 2007
How can select -first X work, but not select -last X Marco Shaw PowerShell 8 14 Dec 2006