Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Mar 2003
    Location
    Gainesville, Florida, USA
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    filecopy (access xp)

    I'm trying to copy an opened mdb file to another directory. I know that if the file is open it wont copy. What other way is there to copy.

    Dim strSrcDir As String
    Dim strDestDir As String
    ' dirname = current applications dir
    strSrcDir = dirname & "2002 dataNSAMidSouthdata.mdb"
    strDestDir = dirname & "2003 data"

    MkDir (strDestDir)
    'FileCopy strSrcDir, strDestDir ' this doesn't work because the file is open
    Shell "copy " & strSrcDir & strDestDir ' this gives file not found


    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: filecopy (access xp)

    The copy command in the Shell should have a space between the source and destination parameters, or should that be a comma?
    What is in the dirname variable?
    Pat

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: filecopy (access xp)

    The first question is why you are trying to do this. What are you trying to accomplish? You can't copy an open file but if you explain why you want to, maybe someone can help you come up with an alternative. The simple answer is to not open the file before you try to copy it.
    Charlotte

  4. #4
    Lounger
    Join Date
    Mar 2003
    Location
    Gainesville, Florida, USA
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filecopy (access xp)

    Thanks for the response. The application opens to a "2002 data" mdb file. Its the most current data file and it must be copied to "2003 data" without losing its previous records. Later, the application gives the user the option to choose which file to work with. The point is that at the end of the year, the client wants a new data set but wants to keep previous year main records instead of re-entering them.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: filecopy (access xp)

    In the first place, if the client wants to keep the old data, what's the point of copying the entire database? You might as well keep the old one.
    In the second place, if it's a matter of creating a copy only at the beginning of a new year, why bother doing this in code? Making a copy manually doesn't take much time.

  6. #6
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Maidstone, Kent, England
    Posts
    398
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filecopy (access xp)

    You can copy an open MDB by using a batch file, at least you can in W2K, but whether this is a good idea is another matter!!


    Peter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •