File Copy with Progress Meter

Sometimes as part of your application you need to copy a file. You can use the built it FileCopy for this purpose, but if you are moving large files, or are moving files over a slow connection it will of course take time. Now if the filecopy takes more then a few seconds, the user might start to think that the application has died, since there is no visual indication that anything is going on, and access might even come to the point of saying “Not responding”.

Well there are ways around this. We need to do the filecopy in chunks, and thankfully I found some code for this here.

I took that code, modified it a bit and added my own progress form to show the progress. The result can be seen below, and you can download the sample file at the bottom of this post.



Download “” – Downloaded 2081 times – 102 KB


The version below has been updated for 64 bit, per request of Rene (See comments). However I do not have a 64 bit environment to test it in, so please let me know of any issues.

Download “” – Downloaded 942 times – 110 KB

15 comments on “File Copy with Progress Meter
  1. Dan Knight says:

    I’ll be giving this a run-thru, but before I do, I’m wondering if this is set to launch for every file or only for files of certain size. In other words, if the file is, say less than 1 MB, then just FileCopy, if greater than 1MB then do the filecopy in chunks and show the progress bar?

    I’m assuming the straight FileCopy (ie: not in chunks) would be faster.

    • TheSmileyCoder says:

      Hi Daniel
      One of the parameters you can pass the function is the chunk size. So setting the chunk size to say 2mb will ensure that files less then 2mb gets copied as 1 chunk.

      The action of showing the progress meter itself is slowing down the copy (the relative slowdown being dependent on your disk/network speed), but I often find that users are more interested in KNOWING that something is going on, than being kept in the dark wondering whether its time to a CTRL-ALT-DEL.

  2. keem says:

    if i have a recordset that needs exporting to excel, how can i apply this? i build the recordset using vba and go from there. how do i set the counter while it’s exporting?

    • TheSmileyCoder says:

      There are some things which are quite difficult to have a progress meter on, because they are performed in a single step, and there is no way to get information on the progress of the process. If you are using the TransferSpreadsheet method, that is such an example. If you are using automation and the .CopyFromRecordset method, then you could specify how many records to export at a time, and thus once in a while update the counter.

  3. Rene says:

    Your progress bar worked well with my ms access 2007 32 bit DB. I recently migrated to ms access 2010 64 bit version and the code for the progress bar is causing errors. – This is the error – The code in the project must be updated fro use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute.

    Do you have an upgraded module?

  4. Daniel says:

    I have tried to use this, both 32bit and 64bit, both return the following error.
    Error Label: “CopyFileByChunk”
    Error: “Runtime error 75: Path/File access error”

    This was without any changes to the downloaded files.

    I am trying to use this when I make a roll back copy of the DB with all the associated folders.

    Any help will be appreciated.

  5. Daniel says:

    64 bit Windows with 32 bit Office.

  6. a says:

    Hi I want to help me connect the progress bar when I attach a file in acecess

Ask a question, leave some feedback, post a reply!

This site uses Akismet to reduce spam. Learn how your comment data is processed.