hfsitumo2001
Member
- Local time
- Today, 15:37
- Joined
- Jan 17, 2021
- Messages
- 365
Code:
Option Compare Database
Public Function SimpleLogin_A_R1() As Boolean
Dim Source As String
Dim Target As String
Dim objFSO As Object
Dim Path As String
Source = CurrentDb.Name
'Path = CurrentProject.Path
Path = "C:\TestDB"
Target = Path & "\BackupDB_" & Format(Now(), "mm-dd-yyyy") & ".accdb"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.folderExists(Path) Then
a = objFSO.copyfile(Source, Target, True)
Else
objFSO.Createfolder (Path)
a = objFSO.copyfile(Source, Target, True)
End If
Set objFSO = Nothing
Set a = Nothing
End Function
can we change the source name? can anyone help?