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

Conditional giving me fits!

I have the following simple conditional on my page,

If EmpIDError <> 1 Then
'Show Input items
End If

Now I need to add another conditional to this,

If PosIDError <> 1 Then
'Show input items
End If

So I made it like this,

If EmpIDError <> 1 OR PosIDError <> 1 Then

But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?

Thanks,
Drew
Jul 22 '05 #1
3 1047
I never figured out how to get them both on the same line, so I just did
this,

<%If EmpIDError <> 1 Then%>
<%If PosIDError <> 1 Then%>

And then added two End Ifs after the code...

thanks,
drew
<
"Drew" <dr********@NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have the following simple conditional on my page,

If EmpIDError <> 1 Then
'Show Input items
End If

Now I need to add another conditional to this,

If PosIDError <> 1 Then
'Show input items
End If

So I made it like this,

If EmpIDError <> 1 OR PosIDError <> 1 Then

But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?

Thanks,
Drew

Jul 22 '05 #2
OR means that the if block should be executed if either condition is true so
the only way that the code will not execute will be if both variables = 1.
If you do not want the code to execute when any one of the variables = 1 you
need to use AND.

Also, make sure that the variables contain a numeric value (not a string
containing a numeric). If you are not sure then include a conversion in the
if statement.

If CLng(EmpIDError) <> 1 OR CLng(PosIDError) <> 1 Then

--
--Mark Schupp
"Drew" <dr********@NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have the following simple conditional on my page,

If EmpIDError <> 1 Then
'Show Input items
End If

Now I need to add another conditional to this,

If PosIDError <> 1 Then
'Show input items
End If

So I made it like this,

If EmpIDError <> 1 OR PosIDError <> 1 Then

But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?

Thanks,
Drew

Jul 22 '05 #3
Thanks! I must've had an extreme brain fart today!

Thanks a bunch!
Drew

"Mark Schupp" <no******@email.net> wrote in message
news:eO**************@TK2MSFTNGP09.phx.gbl...
OR means that the if block should be executed if either condition is true
so the only way that the code will not execute will be if both variables =
1. If you do not want the code to execute when any one of the variables =
1 you need to use AND.

Also, make sure that the variables contain a numeric value (not a string
containing a numeric). If you are not sure then include a conversion in
the if statement.

If CLng(EmpIDError) <> 1 OR CLng(PosIDError) <> 1 Then

--
--Mark Schupp
"Drew" <dr********@NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have the following simple conditional on my page,

If EmpIDError <> 1 Then
'Show Input items
End If

Now I need to add another conditional to this,

If PosIDError <> 1 Then
'Show input items
End If

So I made it like this,

If EmpIDError <> 1 OR PosIDError <> 1 Then

But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?

Thanks,
Drew


Jul 22 '05 #4

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

Similar topics

8
by: neblackcat | last post by:
Would anyone like to comment on the following idea? I was just going to offer it as a new PEP until it was suggested that I post it here for comment & consideration against PEP 308. I'm far...
62
by: Reinhold Birkenfeld | last post by:
Hi, after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y which is the same as today's...
30
by: bnp | last post by:
Hi, Is possible to use functions in conditional operator as ashown below. ..... ..... int fun1() { // body }
12
by: wanghz | last post by:
Hi, Could I ask some questions about the conditional compilaion? Suppose I have three simple files: a.c, b.c and c.h /* --------a.c--------- */ #include <stdio.h> #include "c.h" int...
8
by: jbrewer | last post by:
I'm trying to read in a FITs image file for my research, and I decided that writing a file decoder for the Python imaging library would be the easiest way to accomplish this for my needs. FITs is...
10
by: Dave | last post by:
I'm a C++ programmer of many years, trying to get my feet wet in C#. I have a question about conditional compilation. In C++, I would sometimes define a constant in an include file, and then...
6
by: patrick j | last post by:
Hi I've been testing out the "Conditional Comment" for IE. This is because for my web-site I want to have two style sheets, one for IE 6 and one for other browsers. Thus I hope to have my...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
1
by: Klauer | last post by:
Hello all, I'm kind of new to working with C++, and I have an issue in solving an issue that maybe someone out here can help me with. I have a piece of code in this project that I'm tasked to...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.