File Path Help

bonekrusher

Registered User.
Local time
Today, 11:49
Joined
Nov 19, 2005
Messages
266
Hi,

I nave a code which allows the user to upload a file to a folder "images". I want to be able to record the filename and path in a table called "attachments". But I am not sure how. Can anyone help

Code:
Private Sub Command0_Click()
 
    
    Dim FD As FileDialog
    Dim Name As String
    Dim Name2 As String
    Dim Pathx As String
    Dim Path As String
    Pathx = Me.Application.CurrentProject.Path & "\Images\"
    Path = Me.Application.CurrentProject.Path
    Set FD = Application.FileDialog(msoFileDialogFilePicker)
    Dim vrtSelectedItem As Variant
    With FD
         .AllowMultiSelect = False
         'Add a filter that includes GIF and JPEG images and make it the second item in the list.
         .Filters.Add "PDF", "*.pdf, 1"
          
         'Sets the initial file filter to number 2.
         '.FilterIndex = 2
         
         If .Show = -1 Then
            For Each vrtSelectedItem In .SelectedItems
            Name = Dir(vrtSelectedItem, vbSystem)
            Name2 = Pathx & Name
                If Name2 = vrtSelectedItem Then
                Else
                FileCopy vrtSelectedItem, Pathx & Name
                End If
                     
            Next vrtSelectedItem
           
            
          Else
        End If
    End With
    Set FD = Nothing
 
GHudson,

Thanks But I have hit a wall and can't figure it out. I have already reviewed the "Browesing file" and I am still stumped.
 

Users who are viewing this thread

Back
Top Bottom