jgoodman00
Programmer
- Jan 23, 2001
- 1,510
I am using the following function to check if a file exists:
Function FileExists(strFile as String) as Boolean
FileExists = Dir(strFile) <> ""
End Function
Public FileLocation as Integer
Then within the startup module of my app, i have the following code:
Private Sub Form_Load()
If FileExists ("D:\appname.exe" = True Then
FileLocation = 1
ElseIf FileExists ("E:\appname.exe" = True Then
FileLocation = 2
ElseIf FileExists ("F:\appname.exe" = True Then
FileLocation = 3
Else
MsgBox "The CD cannot be found!!", VBCritical
End Sub
Does anyone have any idea where this is going wrong. If it returns a false on the first part of the statement, it successfully goes onto the second statement. However at this point it breaks out when it runs the FileExists function again, saying runtime error 52, bad filename or number!!! Help me please.... James Goodman
j.goodman00@btinternet.com
Function FileExists(strFile as String) as Boolean
FileExists = Dir(strFile) <> ""
End Function
Public FileLocation as Integer
Then within the startup module of my app, i have the following code:
Private Sub Form_Load()
If FileExists ("D:\appname.exe" = True Then
FileLocation = 1
ElseIf FileExists ("E:\appname.exe" = True Then
FileLocation = 2
ElseIf FileExists ("F:\appname.exe" = True Then
FileLocation = 3
Else
MsgBox "The CD cannot be found!!", VBCritical
End Sub
Does anyone have any idea where this is going wrong. If it returns a false on the first part of the statement, it successfully goes onto the second statement. However at this point it breaks out when it runs the FileExists function again, saying runtime error 52, bad filename or number!!! Help me please.... James Goodman
j.goodman00@btinternet.com