Minggu, 11 Desember 2016

Re: [MS_AccessPros] MSAccess/VBA cannot find file on Mapped drive

 

Dear wir-  (name?)


I assume the first function really has an On Error GoTo IsFileThere_Err.  If it didn't, you wouldn't trap the error.

What is in vFileName or FileToTest?

You could also try:

Dim strPath As String

    strPath = Dir(FileToTest)

    If Len(strPath) = 0 Then MsgBox "File not found."


John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Dec 11, 2016, at 3:29 PM, wlr@genoagroup.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi,


Strange issue.

I cannot determine if a mapped drive file exists.  Local files are OK with both methods. I've tried the 2 methods using the code below and both return false when the file really is there.

Ideas would be appreciated!!!

Thanks, 

WLRatGENOAGROUPdotCOM

DOS DIR <filename> Command shows file exists 


Code I've tried:
-- Using old VB method
Public Function IsFileThere(ByVal vFileName As String) As Boolean
    Open vFileName For Input As #1
    IsFileThere = True
IsFileThere_Exit:
    Close #1
    Exit Function
IsFileThere_Err:
    IsFileThere = False
    Resume IsFileThere_Exit
End Function
Returns error 76

--using FileSystemObject reference
Function FileExistsOnServer(ByVal FileToTest As String) As Boolean
    Dim fs As New Scripting.FileSystemObject
    With fs
        FileExistsOnServer = .FileExists(FileToTest)
    End With
End Function

Returns False





__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar