Determine if a file exist

T

Tony

Before importing data from a Excel file how can I verify
the file exist in the current folder or another folder
 
R

Rick Brandt

Tony said:
Before importing data from a Excel file how can I verify
the file exist in the current folder or another folder

If Dir("PathToFile") = "" Then
'the file does not exist
Else
'the file does exist
End If
 
P

prabha

Hi Tony,

Using Windows API would be the more efficient method. See: HOWTO: Search
Directories to Find or List Files http://support.microsoft.com/?id=185476

It's a VB article but you can implement the same in an Access database
module.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."


--------------------
| Content-Class: urn:content-classes:message
| From: "Tony" <[email protected]>
| Sender: "Tony" <[email protected]>
| Subject: Determine if a file exist
| Date: Wed, 11 Feb 2004 14:39:04 -0800
| Lines: 2
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcPw79pz42RRu7vnThGFVSGFJy8bkg==
| Newsgroups: microsoft.public.access.externaldata
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.externaldata:48858
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.access.externaldata
|
| Before importing data from a Excel file how can I verify
| the file exist in the current folder or another folder
|
 
T

Tony

Eric - Thank you...
I'm still having problems. Can you explain the FileExists
Method. I was hoping to use it to get a True or False
response to determine if a file exist. Its syntax
requires an object that I do not understand.

Syntax = object.FILEEXISTS(filespec)

Where can I find additional information on this method?
 
P

prabha

Hi Tony,

This method is apart of the FileSystemObject, example:

Set fs = CreateObject("Scripting.FileSystemObject")

IF fs.FILEEXISTS(filespec) = True THEN
Msgbox "Found File"
ELSE
Msgbox "Not found"
END IF



--------------------
| Content-Class: urn:content-classes:message
| From: "Tony" <[email protected]>
| Sender: "Tony" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Determine if a file exist
| Date: Thu, 12 Feb 2004 10:30:31 -0800
| Lines: 79
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcPxlkuN826wehrBS5i6h4MExE/HZQ==
| Newsgroups: microsoft.public.access.externaldata
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.externaldata:48889
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.access.externaldata
|
| Eric - Thank you...
| I'm still having problems. Can you explain the FileExists
| Method. I was hoping to use it to get a True or False
| response to determine if a file exist. Its syntax
| requires an object that I do not understand.
|
| Syntax = object.FILEEXISTS(filespec)
|
| Where can I find additional information on this method?
|
|
| >-----Original Message-----
| >Hi Tony,
| >
| >Using Windows API would be the more efficient method.
| See: HOWTO: Search
| >Directories to Find or List Files
| http://support.microsoft.com/?id=185476
| >
| >It's a VB article but you can implement the same in an
| Access database
| >module.
| >
| >I hope this helps! If you have additional questions on
| this topic, please
| >respond back to this posting.
| >
| >
| >Regards,
| >
| >Eric Butts
| >Microsoft Access Support
| >
| >"Microsoft Security Announcement: Have you installed the
| patch for
| >Microsoft Security Bulletin MS03-026? If not Microsoft
| strongly advises
| >you to review the information at the following link
| regarding Microsoft
| >Security Bulletin MS03-026
| ><http://www.microsoft.com/security/security_bulletins/ms03
| -026.asp> and/or
| >to visit Windows Update at
| <http://windowsupdate.microsoft.com/> to install
| >the patch. Running the SCAN program from the Windows
| Update site will help
| >to insure you are current with all security patches, not
| just MS03-026."
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| Wrom: LSZLKBRNVWWCUFPEGAUTFJMVRESKPN
| >| Sender: "Tony" <[email protected]>
| >| Subject: Determine if a file exist
| >| Date: Wed, 11 Feb 2004 14:39:04 -0800
| >| Lines: 2
| >| Message-ID: <[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcPw79pz42RRu7vnThGFVSGFJy8bkg==
| >| Newsgroups: microsoft.public.access.externaldata
| >| Path: cpmsftngxa07.phx.gbl
| >| Xref: cpmsftngxa07.phx.gbl
| microsoft.public.access.externaldata:48858
| >| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| >| X-Tomcat-NG: microsoft.public.access.externaldata
| >|
| >| Before importing data from a Excel file how can I
| verify
| >| the file exist in the current folder or another folder
| >|
| >
| >.
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top