Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - select case does not work ... why?

Reply
 
Old 06-17-2009   #1 (permalink)
Albert Andersson


 
 

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
Old 06-17-2009   #2 (permalink)
Albert Andersson


 
 

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
Reply

Thread Tools


Similar Threads
Thread Forum
Script that uses the DatePart & Case select VB Script
Logon script - function array and select case not working VB Script
Re: Select case question VB Script
Case/Select functionality PowerShell
How can select -first X work, but not select -last X PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46