Originally Posted by
maxbre
YES, THAT IS WHAT I WANT
where should I put the code you just posted?
For multiple file selections you will need to modify your procedure to something like this:
Code:
Private Sub save_form_Click()
Dim fd As Object
Dim strSelectedFile
Dim intFiles As Variant
Dim strNewFilePath As String
Dim strHold As String
'….some code here (not posted)….
If MsgBox("Do you want to upload a file?", vbYesNo, "file") = vbYes Then
Set fd = Application.FileDialog(3)
path_dir = DLookup("path", "pratiche", "[id_pratica]='" & IDPRT & "'")
With fd
.Filters.Clear
.InitialFileName = path_dir
.Title = "Select File to Upload..."
.allowmultiselect = True
.Show
End With
If fd.SelectedItems.Count <> 0 Then
For intFiles = 1 To fd.SelectedItems.Count
strHold = Mid(fd.SelectedItems(intFiles), InStrRev(fd.SelectedItems(intFiles), "\") + 1)
strSelectedFile = fd.SelectedItems(intFiles)
strNewFilePath = Forms!FormNameHere.TextBoxNameHere & IIf(Right(Forms!FormNameHere.TextBoxNameHere, 1) = "\", vbNullString, "\") & strHold
FileCopy strSelectedFile, strNewFilePath
Next
End If
End If
If MsgBox("Do you want to add a new record?", vbYesNo, "continua") = vbYes Then
Call ClearForm
Else
DoCmd.Close
End If
End Sub