473,408 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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 1471
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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...

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.