PDA

View Full Version : If this and If this, then do this, else..


isaaclloyd
05-14-2005, 06:17 PM
Here is an example of what I am trying to do:

<%
.....

ipF = server.mappath("/myfolder/test.txt")

If objFSO.FileExists(ipF) & session("SS1") = "" Then
session("SS1") = "Yes"
etc...

elseIf objFSO.FileExists(ipfile2)
etc....

else
etc....

%>

I want to see if a file exists and if there is a session. If not, then I just want to know if the file exists... if the file doesn't even exists, then etc.. So far with the example above it always goes to the second IF statement. It's like it ignores the first IF statement. Any comments or suggestions would greatly be apreciated. Thanks.

~Isaac~

Freon22
05-14-2005, 08:40 PM
If objFSO.FileExists(ipF) = "" And session("ss1") = "" Then
The AND above means both conditions have to be true for the THEN to work.
OR you can
If objFSO.FileExists(ipF) = "" Or session("ss1") = "" Then
With the OR it only takes one condition to be true for the THEN to work.

Some of the other members can probably expain it better. There is also a lot if different ways of doing this.
Also did the AM/PM from another post of your work?

isaaclloyd
05-14-2005, 10:47 PM
Thanks, Yes the AM/PM script did work.