473,322 Members | 1,398 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,322 software developers and data experts.

If...Then...Else

I want to compare several items and if they are all equal then do
this...otherwise do this...see example below...

If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
..Code..
Else
..Code..
End If
Jul 17 '05 #1
8 10478
"Craig" <cr*************@verizon.com> wrote in message
news:10**************************@posting.google.c om
I want to compare several items and if they are all equal then do
this...otherwise do this...see example below...

If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
..Code..
Else
..Code..
End If


do you mean this?

if a=b and a=c and a=d then
' all equal
else
' not the same
end if
--
Reply to the group so all can participate
VB.Net... just say "No"

Jul 17 '05 #2

"Craig" <cr*************@verizon.com> wrote in message news:10**************************@posting.google.c om...
I want to compare several items and if they are all equal then do
this...otherwise do this...see example below...

If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
..Code..
Else
..Code..
End If


Unless one of those can be Null, according to the example,
you don't need the test. As shown it will always evaluate to
True....

LFS

Jul 17 '05 #3
OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
in my own programs.
"Craig" <cr*************@verizon.com> schreef in bericht
news:10**************************@posting.google.c om...
I want to compare several items and if they are all equal then do
this...otherwise do this...see example below...

If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
..Code..
Else
..Code..
End If

Jul 17 '05 #4
roflmao!

hey, wouldn't it be cool to also have a function that would allow you to
give it the values you wanted to compare against a variable and if a match
existed in the list...return a certain value? i think i'd call that function
"switch-a-roo"...maybe just "SWITCH". but that's years down the line...way
too advanced for the technology we have today! after all, we've still gotta
work out how this "IF THEN ELSE ELSEIF" stuff is going to work! another wish
list item i'd have would be maybe something called "SELECT". its purpose
would be to unclutter IF/THEN/ELSEIF/ELSE when you had a bunch of conditions
where you may want to execute code...maybe call the comparitor value a
"CASE"...like "in case this value is eq. to this other value".

but i digress, that's all just too far in the future.

lol

"arko" <ar**@arko.nl> wrote in message
news:41**********************@dreader6.news.xs4all .nl...
| OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
| in my own programs.
|
|
| "Craig" <cr*************@verizon.com> schreef in bericht
| news:10**************************@posting.google.c om...
| > I want to compare several items and if they are all equal then do
| > this...otherwise do this...see example below...
| >
| > If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
| > ..Code..
| > Else
| > ..Code..
| > End If
|
|
Jul 17 '05 #5
steve joked:
roflmao!

hey, wouldn't it be cool to also have a function that would allow you to
give it the values you wanted to compare against a variable and if a
match
existed in the list...return a certain value? i think i'd call that
function
"switch-a-roo"...maybe just "SWITCH". but that's years down the line...way
too advanced for the technology we have today! after all, we've still
gotta
work out how this "IF THEN ELSE ELSEIF" stuff is going to work! another
wish
list item i'd have would be maybe something called "SELECT". its purpose
would be to unclutter IF/THEN/ELSEIF/ELSE when you had a bunch of
conditions
where you may want to execute code...maybe call the comparitor value a
"CASE"...like "in case this value is eq. to this other value".

but i digress, that's all just too far in the future.

lol


I have a truly radical idea. Maybe we could have variables that could hold
different kinds of data! Like if you set it equal to a string, it would
become a string variable. If you set it to an integer, it would switch to
being an integer.

Wadaya think? Too difficult? Too strange a concept? Would it even be
useful, like if you didn't know what kind of data you were going to get?

If/Then/ElseIf/Else...I'll have to think about that one. We may be onto
something there. I think there's a problem, though. How will the compiler
know how many lies belong to the Else? I think it should have an EndIf or
something like that.

Austin
--
You programmed with 1s and 0s? We only had 0s!
There are no X characters in my address

Jul 17 '05 #6

MAYBE we can even get this new thing to say "HELLO" ??
---------------------------------------------------
"AustinMN" <ta*******@Xatt.net> wrote in message
news:nM*********************@bgtnsc04-news.ops.worldnet.att.net...
steve joked:
roflmao!

hey, wouldn't it be cool to also have a function that would allow you to
give it the values you wanted to compare against a variable and if a
match
existed in the list...return a certain value? i think i'd call that
function
"switch-a-roo"...maybe just "SWITCH". but that's years down the line...way
too advanced for the technology we have today! after all, we've still
gotta
work out how this "IF THEN ELSE ELSEIF" stuff is going to work! another
wish
list item i'd have would be maybe something called "SELECT". its purpose
would be to unclutter IF/THEN/ELSEIF/ELSE when you had a bunch of
conditions
where you may want to execute code...maybe call the comparitor value a
"CASE"...like "in case this value is eq. to this other value".

but i digress, that's all just too far in the future.

lol


I have a truly radical idea. Maybe we could have variables that could hold
different kinds of data! Like if you set it equal to a string, it would
become a string variable. If you set it to an integer, it would switch to
being an integer.

Wadaya think? Too difficult? Too strange a concept? Would it even be
useful, like if you didn't know what kind of data you were going to get?

If/Then/ElseIf/Else...I'll have to think about that one. We may be onto
something there. I think there's a problem, though. How will the compiler
know how many lies belong to the Else? I think it should have an EndIf or
something like that.

Austin
--
You programmed with 1s and 0s? We only had 0s!
There are no X characters in my address
Jul 17 '05 #7

"DaveO" <js******@mweb.co.za> wrote in message
news:cg**********@ctb-nnrp2.saix.net...

MAYBE we can even get this new thing to say "HELLO" ??


Let's not get greedy!

Jul 17 '05 #8
still roflmao!
"AustinMN" <ta*******@Xatt.net> wrote in message
news:1n*********************@bgtnsc05-news.ops.worldnet.att.net...
|
| "DaveO" <js******@mweb.co.za> wrote in message
| news:cg**********@ctb-nnrp2.saix.net...
| >
| > MAYBE we can even get this new thing to say "HELLO" ??
|
| Let's not get greedy!
|
Jul 17 '05 #9

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

Similar topics

0
by: pbdev | last post by:
Hello, I am new to mysql and am trying to write the following sql statement. SELECT item, action, due_date, category FROM maint_due WHERE due_date Between Now() AND IF Select...
1
by: avital | last post by:
Hi, I have a sql query with cases. I need to add a condition that if hasamafactor=5 then display only cases m11-m14 else display the rest. Of course sum ( kamut) as total4mosad has to be only...
19
by: GMKS | last post by:
Hello all, I have 13 check boxes on a form. I am trying to check all the check boxes to determine if they are true or false when I close the form. At present only the first IF...Then...Else...
2
by: misscrf | last post by:
I have a search form that is great. I have modified it in such a way, that when search results come up I can bring it back to a useful spot, say an entry form or a report. Here is my lemon (...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
4
by: louise raisbeck | last post by:
I have this scenario (simplified) function addnewdata () { check for partial match already in db for information entered by user if (partialmatch succeeds) { open new window aspx page (using...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
14
by: lawjake | last post by:
I am having a dispute at work over endifs, and cannot find any treatise on this. So I am hoping that I can get a lot of correspondece confirming my belief. Here it is: I believe the following:...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.