Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using Dir command to get folder names but "Comma's" cause probl 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I want to get all the folder names and match them to records in our db. If a customer's name has a comma in it it throws it to the next line in the list box and deletes the Comma as well.
Example:

ABC Company
DEG Enterprizes
Inc
Therro Company
Greg tharow
Lastoe Company
Inc

So it should DEG Enterprizes, Inc
and Lastoe Company, Inc


Here is code
Code:
    MyPath = "f:\CLIENT ADMIN TAMPA 2007\"    ' Set the path.
    MyName = Dir(MyPath, vbDirectory)    ' Retrieve the first entry.
    Do While MyName <> ""    ' Start the loop.
        ' Ignore the current directory and the encompassing directory.
        If MyName <> "." And MyName <> ".." Then
            ' Use bitwise comparison to make sure MyName is a directory.
            If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
               Me.List2.AddItem MyName    ' Display entry 
            End If    ' it represents a directory.
        End If
        MyName = Dir    ' Get next entry.
    Loop

DougP
[r2d2] < I Built one
 
How about:

Me.List2.AddItem Chr(34) & MyName & Chr(34)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top