Back Up Selected Objects to Another Database
Problem
You use a standard backup program to save your databases, but this works only at the database level. This is fine for archival purposes, but you often want to back up individual objects. How can you get Access to display a list of objects and allow you to save selected ones to an output database you specify?
Solution
This solution shows how to create a form that selectively saves Access objects to another database. It works by using a multiselect list box and the CopyObject action.
Open frmBackup from 06-08.MDB (Figure 6-11). You can use this form to back up selected
objects from the current database to another database. Select one or
more objects from the list box, using the Shift or Ctrl keys to
extend the selection. When you are finished selecting objects and
have specified a backup database (a default database name is created
for you), press the Backup button. The backup process will begin,
copying objects from the current database to the backup database.

Figure 6-11. frmBackup backing up selected database objects
To add this functionality to your own database, follow these steps:
Import frmBackup from
06-08.MDBto your database.Call the backup procedure from anywhere in your application by opening the frmBackup form. For example, you might place a command button on your main switchboard form with the following event procedure ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access