J
JJ
How do I tell it to back up the backend database, and not the frontend,
without having the user enter the path and database name. I would like it to
have something simial to CurrectDBPath, mabey CurDBBEPath.
Also, I have them select a folder to copy the file to, from the Browse
Folder menu, but that didn't work because it does not end with a backslash
and so it thinks that it is the file. Is there a fix for this?
Private Sub cmdBackup_Click()
Dim SourceFile, DestinationFile
SourceFile = CurrentDBPath
DestinationFile = CurrentDBDir
FileCopy SourceFile, DestinationFile
End Sub
Funtions are below:
Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
Function CurrentDBPath() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBPath = Left(strDBPath, Len(strDBPath))
End Function
without having the user enter the path and database name. I would like it to
have something simial to CurrectDBPath, mabey CurDBBEPath.
Also, I have them select a folder to copy the file to, from the Browse
Folder menu, but that didn't work because it does not end with a backslash
and so it thinks that it is the file. Is there a fix for this?
Private Sub cmdBackup_Click()
Dim SourceFile, DestinationFile
SourceFile = CurrentDBPath
DestinationFile = CurrentDBDir
FileCopy SourceFile, DestinationFile
End Sub
Funtions are below:
Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
Function CurrentDBPath() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBPath = Left(strDBPath, Len(strDBPath))
End Function