Results 1 to 2 of 2

Thread: [RESOLVED] Dir on partial name

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Resolved [RESOLVED] Dir on partial name

    I need to locate and print PDF files. However, the only data I have available is the 1st 7 characters. Each file will have a different 7 starting characters. No duplications.

    This is what I have so far:

    Code:
    Dim foundit As String
    '==============================
    Set rs1 = New ADODB.Recordset
    '==============================
    sql = "SELECT * FROM PRTD WHERE LTRIM(RTRIM([CUST])) = " & "'" & "TRIA" & "'"
    sql = sql & " ORDER BY [PRTD]"
    rs1.Open sql, CnxnTechSQL, adOpenKeyset, adLockReadOnly, adCmdText
    If Not rs1.BOF And Not rs1.EOF Then
        rs1.MoveFirst
        Do
            If rs1![actinact] = "A" Then
                name = "C:\Program Files\Junior\PDF\" & rs1![prtd] & "*)"
                foundit = Dir(name)
                If foundit <> "" Then
                    '
                Else
                    msg = msg & rs1![prtd] & vbCrLf
                End If
            End If
            rs1.MoveNext
        Loop While Not rs1.EOF
    End If
    rs1.Close
    Set rs1 = Nothing
    '=================
    Is this the correct way to approach this problem? I have never tried this when I don't have the full file name.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  2. #2

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Dir on partial name

    I got it. I had the wrong path in the statement.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width