You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/access/desktop-database-reference/export-all-data.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,25 +8,25 @@ ms.localizationpriority: medium
8
8
9
9
# Export all data from a Microsoft Access database
10
10
11
-
**Applies to**: Access 2024, Access 2021
11
+
**Applies to**: Access 2024, Access 2021
12
12
13
13
This topic explains how an IT administrator can export all data and objects from a Microsoft Access database to text files, enabling use with other tools and supporting data portability.
14
14
15
15
For data stored in Tables, data can be exported to a variety of other formats using Access Wizards, such as Excel, see [Export data to Excel](https://support.microsoft.com/office/export-data-to-excel-64e974e6-ae43-4301-a53e-20463655b1a9), or text, see [Export data to a text file](https://support.microsoft.com/office/export-data-to-a-text-file-f72dfc38-a8a0-4c5b-8c2c-bf2950814140).
16
16
17
-
The following instructions demonstrate how to export objects using VBA code, using the [DoCmd.TransferText method](https://learn.microsoft.com/office/vba/api/Access.DoCmd.TransferText) command to export table data, and the [Application.SaveAsText](/application-save-as-text) command for other objects.
17
+
The following instructions demonstrate how to export objects using VBA code, using the [DoCmd.TransferText method](/office/vba/api/Access.DoCmd.TransferText) command to export table data, and the [Application.SaveAsText](application-save-as-text.md) command for other objects.
18
18
19
19
The code provided will create a function that can be called with the full path to a database and a destination folder. It will then create a text file for each object in the database, which will contain the data from tables, and the definitions of all user created objects such as forms or reports.
20
20
21
21
Since this process uses OLE automation, the code could also be written using PowerShell or using a .NET language such as C#. For this example, we use VBA.
22
22
23
-
1.Create a new database.
24
-
2. Create a new module.
25
-
3. Copy and paste the following export database code into the module.
26
-
4. For each database that you wish to export, enter the following command in the immediate window:<br>ExportAccessDatabase "_Full path to database_", "*Folder to contain exported objects*".
27
-
a. Note that a new folder will be created in the target folder with the name of the exported database. This is to allow exporting multiple databases to the same target folder while keeping the contents of each exported database in a separate folder.
28
-
b. If the database to be exported contains a startup form, or an AutoExec macro, startup actions may interfere with the export process, so you should reset the Startup Form property for the database, and remove or rename the AutoExec macro before attempting to call ExportAccessDatabase.
29
-
5. If you wish to further automate this process, you could write a function that, given the path to a folder, enumerates all the databases in the folder, and calls teh ExportAccessDatabase function to export each Microsoft Access database to a target folder.
23
+
1.Create a new database.
24
+
1.Create a new module.
25
+
1.Copy and paste the following export database code into the module.
26
+
1.For each database that you wish to export, enter the following command in the immediate window:<br>ExportAccessDatabase "_Full path to database_", "_Folder to contain exported objects_".
27
+
1.Note that a new folder will be created in the target folder with the name of the exported database. This is to allow exporting multiple databases to the same target folder while keeping the contents of each exported database in a separate folder.
28
+
1.If the database to be exported contains a startup form, or an AutoExec macro, startup actions may interfere with the export process, so you should reset the Startup Form property for the database, and remove or rename the AutoExec macro before attempting to call ExportAccessDatabase.
29
+
1.If you wish to further automate this process, you could write a function that, given the path to a folder, enumerates all the databases in the folder, and calls teh ExportAccessDatabase function to export each Microsoft Access database to a target folder.
0 commit comments