Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 4th, 2005, 05:30 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default View Files in a Directory

Does anyone know the best way to get a list of files in a directory?

Currently I am using the following, but am getting an error occasionally...

    strDirPath = GetUserSetting("Import_Folder")

    If Right$(strDirPath, 1) <> "\" Then
        strDirPath = strDirPath & "\"
    End If

    If GetAttr(strDirPath) = vbDirectory Then
        strFileName = Dir(strDirPath, vbDirectory)
        Do Until Len(strFileName) = 0
            ' Exclude ".", "..".
            If (strFileName <> ".") And (strFileName <> "..") Then
                ' Make sure we do not have a sub-directory name.
                If (GetAttr(strDirPath & strFileName) _
                    And vbDirectory) <> vbDirectory Then

                    Set rs = New ADODB.Recordset
                    strSQL = "SELECT file_PK FROM D_Files WHERE file_FilePath = '" & strDirPath & strFileName & "'"
                    rs.Open strSQL, cn
                    If rs.BOF And rs.EOF Then
                        LoadFile (strDirPath & strFileName)
                    End If
                End If
            End If
            strFileName = Dir()
        Loop
    End If

I got it from the Microsoft Site - in case anyone is wondering.

Thanks

Mike
EchoVue.com
__________________
Mike
EchoVue.com
Reply With Quote
  #2 (permalink)  
Old October 15th, 2005, 02:36 PM
Friend of Wrox
 
Join Date: Jul 2005
Location: Oklahoma City, OK, USA.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What line gets the error?

You might also want to check this out:

search drive



Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory.GetFiles got other not related files cmyeung_99 C# 2005 0 June 29th, 2006 09:16 PM
How do I read all the xml files in a directory hkec C# 0 May 11th, 2006 01:10 AM
Active Directory and Windows System Files frleonard ASP.NET 1.x and 2.0 Application Design 0 February 25th, 2006 08:41 PM
directory view yagiroy VS.NET 2002/2003 0 June 11th, 2003 02:35 PM



All times are GMT -4. The time now is 09:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.