GetAttr returns all these parameters at once so that to test if it's a
directory you need to use:

    If GetAttr(DataDir) and vbDirectory = vbDirectory Then

Rich McNeil
Boston Software Systems
866 653 5105
www.bostonworkstation.com
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 10:36 AM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Accessing files on an x: drive


Yeah, I tried that, too.  Using the full path still returns an attribute
value of 2064.

Regarding David Higginson's reply, I saw that in the Help files, too.
The
only attribute that my folder has on is compress.  Now, that's not one
of
the named constants in the help file, and I can't get those to sum at
2064.
There may perhaps be another constant value for compressed directories
that
isn't listed here, that would make it total 2064.

I'm just going to remove the check on the directory, since I know what
it
is and I know it's a directory.  I'm really just curious at this point.

Henry Taylor
Applications Analyst
Lutheran Health Network
Ph. (260) 425-3914


 

                    "Ron Meyer"

                    <[EMAIL PROTECTED]>         To:
<[EMAIL PROTECTED]>                                      
                    Sent by:                     cc:

                    [EMAIL PROTECTED]       Subject:     RE: [Talk]
Accessing files on an x: drive                    
                    TATION.COM

 

 

                    07/09/03 09:15 AM

                    Please respond to Talk

 

 





Try using the full path to the network drive
(\\myserver\bws\selfpay\data)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 7:10 AM
To: [EMAIL PROTECTED]
Subject: [Talk] Accessing files on an x: drive


     I'm just wondering, in order to try and rule out possibilities in
my
troubleshooting, whether I should experience any problems in accessing
files on a mapped drive using BWS and VBA.  I wouldn't think so, but I
need
to be sure.
     When I set a data path constant to 'x:\bws\selfpay\data', I get an
invalid directory error.  I have a function that loops through files in
a
directory and returns the file names in an array; this allows me to
import
multiple files at once.  I've copied the function below.  Based on my
debugging, I believe the error is generated because the GetAttr(DataDir)
does not equal vbDirectory.  What I don't know is why.  I don't know if
there's something inherent in a directory on a mapped drive that will
change the number of the attribute, or if something else is going on.
Anyone have any ideas?

Function GetAllFilesInDir(ByVal DataDir As String) As Variant
    ' Loop through the directory specified in strDirPath and save each
    ' file name in an array, then return that array to the calling
    ' procedure.
    ' Return False if strDirPath is not a valid directory.
    Dim strTempName As String
    Dim varFiles() As Variant
    Dim lngFileCount As Long

    On Error GoTo GetAllFiles_Err

    ' Make sure that strDirPath ends with a "\" character.
    If right$(DataDir, 1) <> "\" Then
        DataDir = DataDir & "\"
    End If

    ' Make sure strDirPath is a directory.
    If GetAttr(DataDir) = vbDirectory Then
        strTempName = Dir(DataDir, vbDirectory)
        Do Until Len(strTempName) = 0
            ' Exclude ".", "..".
            If (strTempName <> ".") And (strTempName <> "..") And
(right(strTempName, 3) <> "rnd") Then
                ' Make sure we do not have a sub-directory name.
                If (GetAttr(DataDir & strTempName) _
                    And vbDirectory) <> vbDirectory Then
                    ' Increase the size of the array
                    ' to accommodate the found filename
                    ' and add the filename to the array.
                    ReDim Preserve varFiles(lngFileCount)
                    varFiles(lngFileCount) = strTempName
                    lngFileCount = lngFileCount + 1
                End If
            End If
            ' Use the Dir function to find the next filename.
            strTempName = Dir()
        Loop
        ' Return the array of found files.
        GetAllFilesInDir = varFiles
    End If
GetAllFiles_End:
    Exit Function
GetAllFiles_Err:
    GetAllFilesInDir = False
    Resume GetAllFiles_End
End Function

Henry Taylor
Applications Analyst
Lutheran Health Network
Ph. (260) 425-3914


The information is intended only for the use of the individual
or entity named above.  The unauthorized recipient of this
information is prohibited from disclosing the information to another
person.
If received in error please notify the sender immediately, destroy the
information that was sent in error, and keep any information you viewed
confidential.  Any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is strictly prohibited.









Reply via email to