Results 1 to 6 of 6

Thread: Copy files (mdb)

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    Copy files (mdb)

    Hi,

    Somebody posted a while ago a method by which you can copy a .mdb file even if it is in use.

    I can't find that thread.

    Does anyone know how to do it?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I believe the CopyFile method of the FSO allows you to copy an open file. Very useful for backups when the db is open.

  3. #3
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    You can also use the CopyFile API function and avoid the bulky FSO.

    VB Code:
    1. Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
    2.  
    3. Private Sub Form_Load()
    4.     CopyFile "C:\My Documents\Greenvil.mdb", "C:\My Documents\aaaa.mdb", True
    5. End Sub
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  4. #4

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    Will the api function copy it even though it is open?

    It's an mdb file.

    Thanks a lot guys.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I'm aware of the CopyFile API but can find no documentation which states it will work on a file that is currently open. Does it?

  6. #6
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Originally posted by vbgladiator
    Will the api function copy it even though it is open?

    It's an mdb file.

    Thanks a lot guys.
    Yes I tried it before I posted the solution.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

Posting Permissions

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



Click Here to Expand Forum to Full Width