Access is still being in used by some companies, even is not perfect choice anymore. So, today I was requested to create a sort of back-up functionality for an Access database which contains linked tables to SharePoint. I have tried some methods, but all them are failed, including FileCopy method from VBA. Still VBA was solving my problem, but code was a little bit different.
Dim fDialog As Office.FileDialog Set fDialog = Application.FileDialog(msoFileDialogSaveAs) With fDialog If fDialog.Show() <> 0 Then Dim Sourcefile As String Dim Destinationfile As String Sourcefile = Application.CurrentProject.Path & "\" & Application.CurrentProject.Name Destinationfile = fDialog.SelectedItems(1) With CreateObject("Scripting.FileSystemObject") .copyfile Sourcefile, Destinationfile End With End If End With
Code is also opening a file save dialog and you can choose the location where you want to copy the database.