Results 1 to 4 of 4

Thread: [RESOLVED] creating a backup of a database? (.mdb)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    94

    Resolved [RESOLVED] creating a backup of a database? (.mdb)

    well, i am using the common dialog control thingy to open a save as dialog at which point the user inputs the filename of the backup database. thats no problem.

    but now there are several things i need to do

    firstly - check whether the filename they entered is an existing file, and if so confirm that they meant to overwrite it

    secondly - i need to actually make a new .mdb file in the desired location. it needs to copy the database from the location app.path() & "\database.mdb" and copy it to the new loaction.

    any help apprieciated

  2. #2
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: creating a backup of a database? (.mdb)

    VB Code:
    1. Private Sub CreateBackup()
    2.     CommonDialog1.ShowSave
    3.     If CommonDialog1.FileName = "" Then Exit Sub
    4.    
    5.     If Len(Dir(CommonDialog1.FileName)) <> 0 Then
    6.         If MsgBox("That file exists already.. would you like to overwrite it?", vbYesNo + vbCritical, "Overwrite?") = vbNo Then Exit Sub
    7.     End If
    8.    
    9.     FileCopy "C:\Pathto\source\database.mdb", CommonDialog1.FileName
    10.    
    11. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: creating a backup of a database? (.mdb)

    For your first question: You can use the flags property of the common dialog control to specify an overwriteprompt
    VB Code:
    1. CommonDialog1.Flags = cdlOFNOverwritePrompt

    Your second question is not completely clear.
    Do you want to create a new mdb file, and copy the data over, or do you want to copy an existing mdb file?

    If you want to copy an existing mdb file, you can use the FileCopy command.
    If the mdb file is in use, it could result in a corrupt copy though.
    Frans

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    94

    Re: creating a backup of a database? (.mdb)

    thanks to both of you, tis sorted now!

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