Check file path and view Wordpad file ???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a form that reads in a file path and checks it for validity. Then my program does some processing and creates a log file on the users local drive. I need a command button to view this file. I cannot find any VBA command to (a) check a file path and (b) invoke Wordpad to view a file

Any ideas?
 
Look at help for the DIR command to check a filepath for validity Eg:
if LEN(DIR(VariableContainingSomefilespec)) = 0 then
' Bad Filespec
else
' Good filespec
End If

Check Out ShellExecute API at http://www.mvps.org/access/api/api0018.htm

Ron W
wthebnartheujkelsbnt said:
I need to create a form that reads in a file path and checks it for
validity. Then my program does some processing and creates a log file on the
users local drive. I need a command button to view this file. I cannot find
any VBA command to (a) check a file path and (b) invoke Wordpad to view a
file
 
Start any version of MSAccess
Type <Ctrl>G to open the immediate window
In the Immediate window type Dir
With the mouse select (hightlight) Dir (you can doubleclick anywhere in the
word)
Push the F1 key

You should be looking at help for the Dir command

Dir will return a zero length string if any part of the filespec is bad, and
the name of the file when it succeds. From the immediate window you can
type ? Dir("c:\") and it will return the first file in the root directory of
your C drive.

Ron W
 
Back
Top