473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select Case Between Value

"Stock Value" Could be anything from 0 to a million or so, and might
include a decimal (12345.67)

I can't find how to do this:

Select Case StockValue
Case 0 To 30000
response.Write("Less than 30000")
Case 30000 To 80000
response.Write("30000 to 80000")
Case 80000 To 180000
response.Write("80000 to 180000")
Case Else ' > 180000
response.Write("Greater than 180000")
End Select

I also tried Case > 0 And <30000 .... and so on

Can anyone advise how to write this select script please?

Thank you

Jon

Jun 6 '06 #1
3 9912
StockValue = 1000
Select Case True
Case StockValue <= 30000: response.Write "StockValue [" & StockValue & "]
IS Less than 30000<br><br>"
Case StockValue <= 80000: response.Write "StockValue [" & StockValue & "]
IS 30000 to 80000<br><br>"
Case StockValue <= 180000: response.Write "StockValue [" & StockValue & "]
IS 80000 to 180000<br><br>"
Case Else: response.Write "StockValue [" & StockValue & "] IS Greater than
180000<br><br>"
End Select

http://mysteryfcm.co.uk/misc/sc_stockvalue.asp

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"J-P-W" <jo******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
"Stock Value" Could be anything from 0 to a million or so, and might
include a decimal (12345.67)

I can't find how to do this:

Select Case StockValue
Case 0 To 30000
response.Write("Less than 30000")
Case 30000 To 80000
response.Write("30000 to 80000")
Case 80000 To 180000
response.Write("80000 to 180000")
Case Else ' > 180000
response.Write("Greater than 180000")
End Select

I also tried Case > 0 And <30000 .... and so on

Can anyone advise how to write this select script please?

Thank you

Jon

Jun 6 '06 #2
Thanks Steve, I guess the Select Case _True_ was what I need to read up
on! Regards
Steven Burn wrote:
StockValue = 1000
Select Case True
Case StockValue <= 30000: response.Write "StockValue [" & StockValue & "]
IS Less than 30000<br><br>"
Case StockValue <= 80000: response.Write "StockValue [" & StockValue & "]
IS 30000 to 80000<br><br>"
Case StockValue <= 180000: response.Write "StockValue [" & StockValue & "]
IS 80000 to 180000<br><br>"
Case Else: response.Write "StockValue [" & StockValue & "] IS Greater than
180000<br><br>"
End Select

http://mysteryfcm.co.uk/misc/sc_stockvalue.asp

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"J-P-W" <jo******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
"Stock Value" Could be anything from 0 to a million or so, and might
include a decimal (12345.67)

I can't find how to do this:

Select Case StockValue
Case 0 To 30000
response.Write("Less than 30000")
Case 30000 To 80000
response.Write("30000 to 80000")
Case 80000 To 180000
response.Write("80000 to 180000")
Case Else ' > 180000
response.Write("Greater than 180000")
End Select

I also tried Case > 0 And <30000 .... and so on

Can anyone advise how to write this select script please?

Thank you

Jon


Jun 6 '06 #3
J-P-W wrote:
"Stock Value" Could be anything from 0 to a million or so, and might
include a decimal (12345.67)

I can't find how to do this:

Select Case StockValue
Case 0 To 30000
response.Write("Less than 30000")
Atually, the To comparison would include 30000, so a value of 30000 would
make this true.
Case 30000 To 80000
response.Write("30000 to 80000")
Case 80000 To 180000
response.Write("80000 to 180000")
Case Else ' > 180000
response.Write("Greater than 180000")
End Select

I also tried Case > 0 And <30000 .... and so on

Can anyone advise how to write this select script please?

Thank you

Jon


In VB, what you've done would work. Unfortunately, this is not one of the
pieces of "syntactic sugar" that survived during the creation of vbscript.
However, there is a workaround:

Select Case True
Case (StockValue<30000)
Case (StockValue>=30000 and StockValue<80000)
etc.
End Select
You can also use
If ... then
ElseIf ... then
Else
End If

Bob Barrows
PS. you can download the vbscript documentation from here:
http://tinyurl.com/7rk6
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers...
10
by: MLH | last post by:
Suppose the following... Dim A as Date A=#7/24/2005# I wish to compare value of A against 2 other values: 1) 8/1/2005 2) 9/1/2005 Which is better and why... First:
16
by: ME | last post by:
In C# the following code generates a compiler error ("A constant value is expected"): public void Test(string value) { switch (value) { case SimpleEnum.One.ToString(): MessageBox.Show("Test...
5
by: =?Utf-8?B?bWNhdWxpZmZl?= | last post by:
I have an old application ( pre-VB5) that I need to add a select/option list to. This is an edit program so the values for the form will be retrieved from a database. How do I set the value of...
2
by: JP2R | last post by:
The following is my code - I'm new to VB - not to Excel - just VB and need some support/guidance/direction (please) I have a spreadsheet and in column "X" titled COS I need to put an integer that...
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
4
by: gregincolumbus | last post by:
I am trying to get the financial calculation on this to trigger whenever there is a change to select1. Right now, the user has to click on select2 to trigger the changes. Ideally, a change of...
21
beacon
by: beacon | last post by:
Hello to everybody, I have a section on a form that has 10 questions, numbered 1-10, with 3 option buttons per question. Each of the option buttons have the same response (Yes, No, Don't know),...
4
by: troy_lee | last post by:
I have a form that acts a filter. All of the filtering objects are in the header and the results are displayed in a continuous form in the detail section. In the header, I have a text box...
4
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.