Results 1 to 6 of 6
  1. #1
    ChuckRS is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2015
    Posts
    3

    need code to copy one file from C drive to E drive

    What is the code so when a command button (on a form) is clicked, one specific file will be copied from c drive to e drive (having a USB flash)?

    The complete pathway to each specific c drive file is in a field in every record. The form can display up to 30 command buttons with each being associated with a different c drive file

    Added the below after the post by Orange

    The form will display up to 30 thumbnails of full size photos. There are various needs to have a copy of the full size photo. Rather than trying to remember the file name and route through the folders to get to the photo then copy to the flash drive, do so within the Access form with a command button.

    The photo db has hundreds of ways to search for photos



    I was previously registered but I must have the log in name and or password wrong and my email has changed
    Last edited by ChuckRS; 02-19-2015 at 09:49 AM.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738
    ??? Why do you want to use Access for this?? Please tell us more.

    Have you tried Google

    FSO

  3. #3
    ChuckRS is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2015
    Posts
    3
    The form will display up to 30 thumbnails of full size photos. There are various needs to have a copy of the full size photo. Rather than trying to remember the file name and route through the folders to get to the photo then copy to the flash drive, do so within the Access form with a command button.

    The photo db has hundreds of ways to search for photo

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738
    Chuck,

    I responded to your PM. I also found this link (but haven't tried it).

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Look into FileCopy method.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,046

    Code example with filescript object

    Hi,

    you could use the filesystemobject, example:

    Code:
    Public Function MoveFile(strFile As String, strLoc As String) As Boolean
    On Error GoTo Err_MoveFile
      Dim fsoImport As Object
      Dim floImportFile As Object
      
      Set fsoImport = CreateObject("Scripting.FileSystemObject")
      Set floImportFile = fsoImport.GetFile(strFile)
      If strFile <> strLoc Then
        floImportFile.Move strLoc
      End If
      MoveFile = True
    Exit_MoveFile:
        Set fsoImport = Nothing
        Set floImportFile = Nothing
        Exit Function
        
    Err_MoveFile:
        MoveFile = False
        Debug.Print Err.Number & ": " & Err.Description
        Resume Exit_MoveFile
    End Function
    The code can be called as follows:


    movefile("C:\mydata\myfile.txt","C:\test\myfile.tx t")

    greetings
    NG

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-02-2014, 09:46 AM
  2. Replies: 2
    Last Post: 11-19-2013, 11:44 AM
  3. Replies: 7
    Last Post: 11-28-2012, 03:13 PM
  4. Replies: 10
    Last Post: 03-04-2012, 12:17 AM
  5. View .txt file on hard drive
    By nfaunt in forum Programming
    Replies: 0
    Last Post: 04-04-2011, 09:49 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