Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    You don't need to copy the files using FSO. You can just simply use


    Code:
    Name OldPathAndFileNameWithExtension NEWPathAndFileNameWithExtension


    As for multiselect, I guess I'm not understanding what your intention is. Is it to select some files and then copy those files to the location that is in the text box on the form? If so, it will take a little more code than we currently have.


    EDIT: The code I gave you there was actually to MOVE the files, not copy. Hold on while I fix that.
    Last edited by boblarson; 11-03-2011 at 10:23 AM. Reason: messed up

  2. #17
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Okay, to COPY the files you would use

    FileCopy OldPathAndNameHere NewPathAndNameHere

  3. #18
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    Is it to select some files and then copy those files to the location that is in the text box on the form?
    YES, THAT IS WHAT I WANT

    where should I put the code you just posted?

    after the the with statement?
    sorry but I'm now a bit lost

  4. #19
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by maxbre View Post
    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

  5. #20
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    thanks bob
    now with a little tweaking the problem will be sorted out

    thanks agani for this long and winding session

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pause / Wait / Countdown / Timer
    By DevGreg in forum Programming
    Replies: 2
    Last Post: 07-19-2022, 06:30 AM
  2. Shell with Batch Variables
    By robbyaube in forum Programming
    Replies: 2
    Last Post: 12-19-2019, 11:06 AM
  3. Using Shell in VBA
    By ghutche in forum Programming
    Replies: 7
    Last Post: 03-17-2011, 10:13 AM
  4. Wait for query to finish
    By MikeDS in forum Programming
    Replies: 1
    Last Post: 01-28-2011, 10:17 AM
  5. Open Form with instance method & wait to close?
    By GeorgeBakoyannis in forum Forms
    Replies: 1
    Last Post: 10-09-2010, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums