Okay, this will work:
Dim objFSO 'no variable type declaration or use Variant
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Path\Filename.csv") Then
...do your processing here
Else
MsgBox("File does not exist")
Exit Sub
End If
This VBScript code should work within Access unless your security settings prevent scripts from working outside of the application or your system settings prevent scripts from scanning file systems. This is rare, however, since most people use default settings.
When the user opens Access, they will want to make sure they don't put the app in sandbox mode.
Anyway, I use this sort of scripting all the time in my apps.
Did this work for you?
mmcdonal
|