Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF OR Statement

Status
Not open for further replies.

ErrolDC

MIS
May 26, 2004
72
US
Hi folks.
Is it possible to use an IF OR statement? I want to check for the presense of file_A OR file_B. If either one of them exists, THEN...
So, it looks like..

Code:
set fso = CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(file_a) OR fso.FileExists(file_b) Then

..

but that does not work. Am I doing something wrong?
 
try this
Code:
set fso = CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(file_a) OR NOT fso.FileExists(file_b) Then
 
I'm sorry I didn't read what you wanted close enough. If you want the event to fire if EITHER of the files exist then it would be:

Code:
if  fso.FileExists(file_a) OR fso.FileExists(file_b) Then

do not have the NOT statements.. that would only fire if the file didn't exist.

In any case, you have to do the full test after each OR or AND that are in the If...Then statement.
 
hmm.. still not working.
If either of the files do not exist, THEN i want to proceed.
 
Oh, do NOT exist well then it would be

Code:
if Not fso.fileExists(file_a) OR Not fso.FileExists(file_b) then
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top