473,387 Members | 3,821 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,387 software developers and data experts.

Nested If

I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!
Nov 20 '05 #1
9 1330
Hi,

What is sCmd?

In any case, it seems straightforward - if this is the code sequence, sTo
ends up being the designated email address or sCmd. What am I missing here?

Bernie

"Thanks2U" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!

Nov 20 '05 #2

"Thanks2U" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!


If iCall_Type = 9 Then
sTo = sCmd
ElseIf sToEmail = "" Then
sTo = "DT" & CStr(lDistrictNbr) & "@microsoft.com"
Else
sTo = sToEMail
End If

Is this what you need?

Mythran
Nov 20 '05 #3
* "Thanks2U" <an*******@discussions.microsoft.com> scripsit:
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.


\\\
If ... Then
...
ElseIf ... Then
...
ElseIf ... Then
...
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
He indicated that both If's need to be evaluated. In yours,

ElseIf sToEmail = "" Then

will not be tested if: iCall_Type = 9

"Mythran" <ki********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...

"Thanks2U" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!


If iCall_Type = 9 Then
sTo = sCmd
ElseIf sToEmail = "" Then
sTo = "DT" & CStr(lDistrictNbr) & "@microsoft.com"
Else
sTo = sToEMail
End If

Is this what you need?

Mythran

Nov 20 '05 #5
Cor
I did not understand the question, now I saw the message from Scott I
understand it.

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else

If iCall_Type = 9 Then
sTo = sCmd
else
sTo = sToEMail
End if
///

Cor
Nov 20 '05 #6
I still don't think that this will satisfy the original requirement that
both if statements be evaluated. In yours, if:

oEMail = ""

then iCall_Type will not be tested for 9.

I think he just needs the 2 if statements, one after the other.

His original post showed him ussing:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else
sTo = sToEMail
End If

If iCall_Type = 9 Then
sTo = sCmd
End if

This seems to be correct to me. The question now becomes, which if is more
important than the other. If he has one variable that will be changed by
one of 2 other variable values, then is it more important that sTo be sCmd
when iCall_Type is 9 or not. The order of the if statements may need to be
reversed.

"Cor" <no*@non.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl...
I did not understand the question, now I saw the message from Scott I
understand it.

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
Else

If iCall_Type = 9 Then
sTo = sCmd
else
sTo = sToEMail
End if
///

Cor

Nov 20 '05 #7
Cor
In your sample will the previous test be for nothing if cmd = 9

If the 9 test would be the most important, than it should in my example have
to change place with the test for space
I still don't think that this will satisfy the original requirement that
both if statements be evaluated. In yours, if:

Nov 20 '05 #8
Not sure what test you mean by "previous test", but in my example (actually
the original post's example), both tests are carried out.

I just don't see how your nested If test in the Else section would be
carried out if the first If returns true.
"Cor" <no*@non.com> wrote in message
news:Om**************@TK2MSFTNGP10.phx.gbl...
In your sample will the previous test be for nothing if cmd = 9

If the 9 test would be the most important, than it should in my example have to change place with the test for space
I still don't think that this will satisfy the original requirement that
both if statements be evaluated. In yours, if:


Nov 20 '05 #9
Cor
There is a typo in, but I asume that you did see that the last "end if" was
missing.
If sToEMail = "" Then
(if there is no emailadres send a mail to microsoft)
sTo = "DT" & CStr(lDistrictNbr)"@microsoft.com"
(if there is an mail adres than do something else)
Else If iCall_Type = 9 Then

(if it is a Icall, let say intern, than do this)
sTo = sCmd
else
(send to the email adres)
sTo = sToEMail
end if
End if
///Not sure what test you mean by "previous test", but in my example (actually
the original post's example), both tests are carried out. I just don't see how your nested If test in the Else section would be
carried out if the first If returns true.


Nov 20 '05 #10

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

Similar topics

0
by: Glen | last post by:
I have a Struts action form which contains a bean. I am trying to display a bean retrieved from the database in this form using the nested tag. Can anyone help me? I continue to get an error...
6
by: Andy Baker | last post by:
Hi there, I'm learning Python at the moment and trying to grok the thinking behind it's scoping and nesting rules. I was googling for nested functions and found this Guido quote:...
3
by: Erik Bongers | last post by:
Hi, Nested classes only seem to be able to access static members of the surrounding class : class SurroundingClass { public: class InnerClass { public:
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
6
by: B0nj | last post by:
I've got a class in which I want to implement a property that operates like an indexer, for the various colors associated with the class. For instance, I want to be able to do 'set' operations...
8
by: Robert W. | last post by:
I've almost completed building a Model-View-Controller but have run into a snag. When an event is fired on a form control I want to automatically updated the "connnected" property in the Model. ...
1
by: Tomas Sieger | last post by:
Hi all, I'm in doubt with the following code: class Base { public: class Nested {}; }; class Derived:public Base { public: class Nested {
77
by: Peter Olcott | last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html The above link shows that C# is 450% slower on something as simple as a nested loop....
7
by: patrick j | last post by:
Hi I'm wondering about lists with nested lists as one does on a Saturday afternoon. Anyway below is an example of a list with a nested list which the iCab browser's very useful HTML...
3
by: jdurancomas | last post by:
Dear all, I'm trying to declare the operator++ to a nested class. The nested class is not template but the container it is. The code used in teh sample program is included bellow: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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...

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.