DIR function doesn't recognize file 
Author Message
 DIR function doesn't recognize file

My VB4 application uses the DIR() function to check for the existence of a
file created by a DOS program.

The parameters to the DIR function identify the file path and name; if this
file exists, processing continues.

The problem is, even though the DOS program saves the file correctly
(appropriate path and name), the VB program doesn't recognize it.  If I
create the file from a windows program, the VB program recognizes the file.

My assumption is that the DOS-generated file is not registering in
windows95, so the VB program never sees it.  

If you have any idea how to remedy this problem, please drop me a line.
Thanks.



Sun, 05 Dec 1999 03:00:00 GMT  
 DIR function doesn't recognize file



Quote:
> My VB4 application uses the DIR() function to check for the existence of
a
> file created by a DOS program.
> The parameters to the DIR function identify the file path and name; if
this
> file exists, processing continues.
> The problem is, even though the DOS program saves the file correctly
> (appropriate path and name), the VB program doesn't recognize it.  If I
> create the file from a windows program, the VB program recognizes the
file.
> My assumption is that the DOS-generated file is not registering in
> windows95, so the VB program never sees it.  
> If you have any idea how to remedy this problem, please drop me a line.
> Thanks.

I don't know why the DIR function cannot see your file, but try using the
Open statement (with an error trap) to look for it, like this:

Function FileExists (byval FileName as string) as boolean
 dim FileNumber as integer
 FileNumber = freefile
 on error resume next
 open FileName for input as #FileNumber
 FileExists = (Err.Number = 0)
 Close #FileNumber
 on error goto 0
end function

This works because open will generate an error if a file it is attempting
to open (for input) doesn't exist.  I haven't tested this example, but I've
used similar code before.
Hope this helps
Mike



Sun, 05 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HELP : Access 97 doesn't recognize my MDB file

2. Dir function fails to recognize UNC

3. VBA Doesn't recognize DAO.RecordSet

4. Doesn't recognize name or names

5. VB doesn't recognize ODBC stuff.

6. Doesn't recognize stored procedure parameter

7. VBScript doesn't recognize date in Hebrew

8. Setup Wizard doesn't recognize LAN drive on NT 4.0

9. DATE TIME PICKER DOESN'T SEEM TO RECOGNIZE NULL

10. CRW 7 doesn't recognize date fields?

11. Help: Crystal doesn't recognize access 2000 table

12. Still doesn't recognize Access2000 db

 

 
Powered by phpBB® Forum Software