How To Create Auto-Backup Database
How To Create Auto-Backup Database
com
y( )
Tables (10)
VBA Functions (23)
Ads by
Send feed
Write More Effectively
Why this a
Grammarly In
Select Language
HOME HOWTO VBA FUNCTIONS VIDEO TUTORIALS DOWNLOAD CONTACT US LOG IN Recent
Posts
Categories
Function (17)
Only 5 Mins to recover Data
MS Access & SQL (11)
Super easy to use. Download and Recover it! MS Excel VBA How To (7
Other (22)
Queries (11)
Ads by
Send feed
Why this a
Select Language
Recent Posts
Categories
Explanation: Ads by
Path = CurrentProject.Path = the location of the current folder that contains the Send feed
Access database file
Why this a
Source = CurrentDb.Name = the current Access database file
Target = Path & “\BackupDB ” = the new file location to be saved to, and the file
name starts with BackupDB. The backup location is the same as the current file in this
example.
Format(Now(), “mm-dd”) & “.accdb” = name the new file to end with the month-day
(Ex: 08-24) and set the file type to .accdb after BackupDB
Set objFSO = CreateObject(“Scripting.FileSystemObject”) = allow the computer Select Language
system to create a new file
CopyFile(Source, Target, True) = the computer system will copy the current file Recent Posts
(Source) to the assigned location (Target)
How to Add Group Head
The Scripting.FileSystemObject is used to gain an access to a computer’s file system. It can
create new files, folders, directory paths, and access existing ones. The FileSystemObject Understanding MS Acces
has many usable methods such as CopyFile, DeleteFile, CopyFolder etc.
How to Use a Report Wi
More information about FileSystemObject here How to Use a Report De
How to create a Query f
How to Use Join Propert
How to create a Simple L
Login Form
How to Display Yes or N
Field
How to Display the Tota
One Query
How to Create a Split Fo
Function (17)
MS Access & SQL (11)
MS Excel VBA How To (7
Other (22)
Queries (11)
Recordset (3)
Reports (12)
Set Security (5)
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 3/10
4/26/22, 3:36 PM How to Create Auto-Backup Database - iAccessWorld.com
y( )
Ads by
Tables (10)
Send feedback Why this ad?
VBA Functions (23)
Ads by
Send feed
Why this a
Select Language
Recent Posts
Categories
Function (17)
MS Access & SQL (11)
MS Excel VBA How To (7
Other (22)
When you open the Access database file, the file you set to display under the Access Queries (11)
Options above will open, in this case, the Navigation Form. While the Navigation Form is Recordset (3)
loading, the computer system will make a copy of this file and rename it as specified in the
Reports (12)
CreateBackup() function.
Set Security (5)
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 4/10
4/26/22, 3:36 PM How to Create Auto-Backup Database - iAccessWorld.com
y( )
Ads by
Tables (10)
Send feedback Why this ad?
VBA Functions (23)
Ads by
Send feed
Why this a
After you open the current folder of your current Access file, you will see the backup of Select Language
your Access file with the name, in this example, “BackupDB 08-08”, as shown below.
Recent Posts
Categories
Function (17)
Call the CreateBackup() function under the Fom_Close() procedure as shown below.
MS Access & SQL (11)
MS Excel VBA How To (7
Other (22)
Queries (11)
Recordset (3)
Reports (12)
Set Security (5)
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 5/10
4/26/22, 3:36 PM How to Create Auto-Backup Database - iAccessWorld.com
y( )
Ads by
Tables (10)
Send feedback Why this ad?
VBA Functions (23)
Ads by
Send feed
Why this a
Select Language
Recent Posts
Categories
Result:
Access Macro (9)
Path = “C:\Users\Tewan\Desktop\How to Create Auto-Backup”
Source = How to Create Auto-Backup DB.accdb Field Format (4)
Target = “C:\Users\Tewan\Desktop\How to Create Auto-Backup\BackupDB “
Forms (49)
Target = “C:\Users\Tewan\Desktop\How to Create Auto-Backup\BackupDB 08-08.accdb”
Combo box (9)
I will illustrate more examples of changing the Path (the destination of backup file) and
List box (5)
Target (the name of new file) in the VB code below.
Search Form (1)
VBA Code:
Function (17)
MS Access & SQL (11)
Path = "C:\TestDB"
Target = Path & "\BackupDB " & Format(Now(), "mm-dd hh") & ".accdb" MS Excel VBA How To (7
Other (22)
Queries (11)
Result:
Recordset (3)
Path = “C:\TestDB”
Target = “C:\TestDB\BackupDB 08-08 12.accdb” (created a backup on August 8, 2020 at Reports (12)
12:15 PM) Set Security (5)
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 6/10
4/26/22, 3:36 PM How to Create Auto-Backup Database - iAccessWorld.com
y( )
Ads by
Tables (10)
Send feedback Why this ad?
VBA Code: VBA Functions (23)
Why this a
Result:
Path = “C:\TestDB”
Target = “C:\TestDB\BackupDB 08-09 12_20 PM.accdb” (created a backup on August 9,
2020 at 12:20 PM)
Select Language
VBA Code:
Recent Posts
Path = "C:\TestDB"
Target = Path & "\BackupDB_" & Format(Now(), "mm") & ".accdb"
How to Add Group Head
Understanding MS Acces
How to Use a Report Wi
Result:
How to Use a Report De
Path = “C:\TestDB”
Target = “C:\TestDB\BackupDB_08.accdb” (created a backup on August 9, 2000 at 12:20 How to create a Query f
PM) How to Use Join Propert
How to create a Simple L
Login Form
VBA Code: How to Display Yes or N
Field
Path = "C:\TestDB" How to Display the Tota
Target = Path & "\BackupDB.accdb" One Query
How to Create a Split Fo
Result:
Categories
Path = “C:\TestDB”
Target = “C:\TestDB\BackupDB.accdb” (Save the backup on one file only. The new file will
override the old file) Access Macro (9)
Field Format (4)
You must have a folder called “TestDB” in your computer’s C drive (drive C:) for the Path =
“C:\TestDB”, otherwise you will get an error as shown below. Forms (49)
Combo box (9)
List box (5)
Search Form (1)
Function (17)
MS Access & SQL (11)
MS Excel VBA How To (7
Other (22)
Queries (11)
Recordset (3)
Reports (12)
Set Security (5)
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 7/10
4/26/22, 3:36 PM How to Create Auto-Backup Database - iAccessWorld.com
y( )
Now we can add more Ads codesby
to test if the assigned folder exists and to create the folder
before creating the backup file. I will use the FileSystemObject method to test or create Tables (10)
Send feedback Why this ad?
the folder inside the If…Statement as shown below. By doing this we won’t get an error. VBA Functions (23)
Select Language
Recent Posts
Ads by
Send feed
Why this a
Select Language
Recent Posts
How to Sort Data Using VB in Excel Part 2 How to Use AutoExec in MS Access How to create a Simple L
Login Form
How to Display Yes or N
Related posts Field
How to Display the Tota
One Query
How to Create a Split Fo
Function (17)
MS Access & SQL (11)
MS Excel VBA How To (7
Other (22)
Queries (11)
Recordset (3)
Reports (12)
Set Security (5)
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 9/10
4/26/22, 3:36 PM How to Create Auto-Backup Database - iAccessWorld.com
y( )
Ads by
Tables (10)
Send feedback Why this ad?
VBA Functions (23)
Ads by
Send feed
Why this a
Google
My Youtube
Donate
Terms And Policy
https://www.iaccessworld.com/how-to-create-auto-backup-database/ 10/10