473,471 Members | 2,040 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

If then else query...

I insert a number into textbox1 between the number of 1
and 37 and i need to manipulate what the user puts in.
For instance if they put between 1 and 5 they get a
certain price and between 6 and 10 annother price and so
on.. I tried coding...

If textbox1 = 1 to 5
then msgbox("£16.00")
else
if textbox1 = 6 to 11
then msgbox("£25.00")

etc...

Please note I did that off the top of my head at work and
can anybody advise me the best way to do this in vb.net..

Jul 21 '05 #1
4 1472
I would probably try something like this:

If me.textbox1.text <6 Then
msgbox("something")
else
if me.textbox1.text < 11Then
msgbox(something else)
else
if .... so on and so forth
end if
end if

Hope that helps.

"Scott" wrote:
I insert a number into textbox1 between the number of 1
and 37 and i need to manipulate what the user puts in.
For instance if they put between 1 and 5 they get a
certain price and between 6 and 10 annother price and so
on.. I tried coding...

If textbox1 = 1 to 5
then msgbox("£16.00")
else
if textbox1 = 6 to 11
then msgbox("£25.00")

etc...

Please note I did that off the top of my head at work and
can anybody advise me the best way to do this in vb.net..

Jul 21 '05 #2
OK the coding generally helps but you see the values are
in between values...

1-5 days = £16.00
6-11 days = £25.00
12-16 days = £32.00

and so on and so forth up to 38 days.

So i need an expression that says if textbox1 = between 1
and 5 then show whatever

and

if textbox1 = between 6 and 11 then show whatever ...

and so on up to 38days...

cheers
Jul 21 '05 #3
select case int.parse(textbox.text)
case 1 to 5
do something here
case 6 to 10
do something here
case else
handle anything else here
end select
Jul 21 '05 #4
Take one from the number of days, divide (integer arithmetic) by 5.
Then you have a simple case statement:
case 0:
MessageBox( "16" );
case 1:
... "25"

and so on. If you have an expression to calculate the amount from the number
of days, that's great, otherwise you could have a lookup that returns the
price. Then you only need one MessageBox statement and a function to give
you the price from the ( numberOfDays - 1 ) / 5.

Steve

<an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
OK the coding generally helps but you see the values are
in between values...

1-5 days = £16.00
6-11 days = £25.00
12-16 days = £32.00

and so on and so forth up to 38 days.

So i need an expression that says if textbox1 = between 1
and 5 then show whatever

and

if textbox1 = between 6 and 11 then show whatever ...

and so on up to 38days...

cheers
Jul 21 '05 #5

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

Similar topics

1
by: Chris | last post by:
Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm going wrong? Thanks in advance and sorry again...
1
by: George | last post by:
Hi, I'm trying to run a select statement that takes includes an if/else clause. I need to select the 'tran_date' between.... if the current month is greater than 10 i.e. after OCT then the...
6
by: Karen Middleton | last post by:
In MS Access I can do in one SQL statement a update if exists else a insert. Assuming my source staging table is called - SOURCE and my target table is called - DEST and both of them have the...
2
by: turtle | last post by:
I am having a hard time doing the following in a query. I need my field "EarnedValue" to return the result depending on other fields. The code in VB would look like this: If > 0 and =...
8
by: Carl | last post by:
Hi, Using MS Access 2000, is it possible to run a UPDATE or INSERT SQL query using some form of conditional IF THEN ?? for example: SELECT * FROM Books IF EXISTS(Select Books.ID = 1)
2
by: naughtybynature | last post by:
<html> <head> <title>Search Questions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $query = '';
1
by: naughtybynature | last post by:
<html> <head> <title>Search Questions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $query = '';
3
by: dannymac83 | last post by:
I have been teaching myself access and VBA for the past week and am extraordinarily confused. I have a table full of employee data, including social security numbers. I want to search the table for...
2
by: paulw4 | last post by:
Need some help here... I am working in Access and have a query that gets selection criteria from a form with 6 selection options. I also want to be able to check for "all: in any of the 6 combo...
4
by: lutzkac | last post by:
Hi Everyone, I am in a bit of a pickle and need some expert advice. I have a db in access. I am trying to create a query with fields from the tables. In my query I need to take the value of one...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.