Conditional giving me fits!

D

Drew

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
 
D

Drew

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


<
 
M

Mark Schupp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top