View Full Version : Make a copy of DB and move it


g-richardson
05-16-2007, 07:05 AM
Hi,

I am trying to continue the process described below. We are taking a query from an active database and creating a table in a remote db in the network...we want to take the next step in the process to now copy the destination database and have the user save it to a location of their choosing so they can manipulate the data...

The code so far (works great...)

If [Forms]![frm_ProductSelect]![chkDetail2EXLRpt] Then
DoCmd.OpenReport "RPT_Dashboard_FULL_REPORT", acViewPreview
'DoCmd.OpenQuery "qry_PolLevelDetail"
'DoCmd.RunCommand acCmdExport
'DoCmd.Close acQuery, "PolLevelDetail"
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"\\bostvfs01\data1\Access\Dashboard\UL\PolDetail.md b", acTable, _
"PolLevelDetail", "PolDetail" & [Forms]![frm_ProductSelect]![Product], 0
msgbox "Export done"
End If



Any help appreciated.

Moniker
05-16-2007, 07:32 AM
Have you investigated this command:

DoCmd.CopyObject

Full Description:
DoCmd.CopyObject(DestinationDatabase, NewName, SourceObjectType, SourceObjectName)

I believe that will do what you want. To get the DestinationDatabase (where you want to save the DB), you can use a FileDialog object, which will require a reference to the Office X.0 Object Library. That will expose the standard file dialog boxes the users are already familiar with and allow them to select a path to save to.

g-richardson
10-31-2007, 05:59 AM
Moniker...THANKS so much. I found this same solution independent of this forum and forgot to come back to check it out. Thanks again for the spot on advice. Great job.