• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

save an open database as a new file

A user opens an Access DB with OpenFileDialog. After looking it over the user clicks a button to "save a backup" of the file. The user wants to save the file with a new name, which the user will create.

The user may choose to put it in the same folder or perhaps in a different one.

Can't get the code right.   :(

VBE 2010
1 Solution
Close the database, then

                File.Copy(OriginalFile, NewFile, blnOverwrite)

blnOverwrite should be True to overwrite any existing file, False to give an error if a file exists with the output name.

Then open the database again, and continue on.

I normally use a SaveFileDialog for the user to specify the output name. You can set the OverwritePrompt property to get a warning message if a file of that name already exists.
author3000Author Commented:
Works for me!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now