hello, i run a small app to manage various stuff to do with our server, im running access 2007 and a friend of mine is running access 2003
i have some code that downloads logs from a remote location if they are present, theirs a small bit of code that test whether its downloaded any and if they are present in the local logs dir, the code is
my friends access 2003 gets the logs, the logs are present in the logs dir but he still gets the no new logs message, even tho they are present
mine running access 2007 runs fine with ni problems, im guessing its a problem with the FileExist module, the code for that is here
can anybody suggest a solution so works on 2003 as well as 2007
scoobs
i have some code that downloads logs from a remote location if they are present, theirs a small bit of code that test whether its downloaded any and if they are present in the local logs dir, the code is
Code:
If FileExists("C:\Snipers MS2\logs\*.*") = False Then
MsgBox ("No New Logs")
Exit Sub
End If
mine running access 2007 runs fine with ni problems, im guessing its a problem with the FileExist module, the code for that is here
Code:
Option Compare Database
Function FileExists(ByVal strFile As String, Optional bFindFolders As Boolean) As Boolean
'Purpose: Return True if the file exists, even if it is hidden.
'Arguments: strFile: File name to look for. Current directory searched if no path included.
' bFindFolders. If strFile is a folder, FileExists() returns False unless this argument is True.
'Note: Does not look inside subdirectories for the file.
'Author: Allen Browne. http://allenbrowne.com June, 2006.
Dim lngAttributes As Long
'Include read-only files, hidden files, system files.
lngAttributes = (vbReadOnly Or vbHidden Or vbSystem)
If bFindFolders Then
lngAttributes = (lngAttributes Or vbDirectory) 'Include folders as well.
Else
'Strip any trailing slash, so Dir does not look inside the folder.
Do While Right$(strFile, 1) = "\"
strFile = Left$(strFile, Len(strFile) - 1)
Loop
End If
'If Dir() returns something, the file exists.
On Error Resume Next
FileExists = (Len(Dir(strFile, lngAttributes)) > 0)
End Function
Function FolderExists(strPath As String) As Boolean
On Error Resume Next
FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory)
End Function
Function TrailingSlash(varIn As Variant) As String
If Len(varIn) > 0 Then
If Right(varIn, 1) = "\" Then
TrailingSlash = varIn
Else
TrailingSlash = varIn & "\"
End If
End If
End Function
scoobs
Last edited by a moderator: