Skip to content

Commit 8dfa0d4

Browse files
authored
Merge pull request #802 from MicrosoftDocs/lindalu-add-command-application-save-as-text
Lindalu add command application save as text
2 parents eef5934 + f5c78aa commit 8dfa0d4

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Application.LoadFromText
3+
TOCTitle: Application.LoadFromText
4+
ms:assetid: 6cd9963e-7edc-4834-b4c2-0983fe47e72b
5+
ms.date: 08/06/2024
6+
ms.localizationpriority: medium
7+
---
8+
9+
# Application.LoadFromText
10+
11+
**Applies to**: Access 2024, Access 2019
12+
13+
The Application.LoadFromText is a method used to import database objects (like forms, reports, queries, etc.) from a text file into an Access database. This is often paired with [Application.SaveAsText](application-save-as-text.md), which exports database objects to text files. These methods are particularly useful for version control, backups, or transferring objects between databases.
14+
15+
## Syntax
16+
17+
Application.LoadFromText _ObjectType_, _ObjectName_, _FileName_
18+
19+
## Parameters
20+
21+
|Parameter|Description|
22+
|:--------|:-----------|
23+
|_ObjectType_|The type of object (e.g., acForm, acReport, acQuery, etc.).|
24+
|_ObjectName_|The name of the object to be imported.|
25+
|_FileName_|The full path to the text file containing the object definition.|
26+
27+
## Example
28+
29+
Here’s how you can import a form that was saved as a text file.
30+
31+
```vba
32+
Application.LoadFromText acForm, "MyForm", "C:\Backup\MyForm.txt"
33+
```
34+
35+
## Remarks
36+
37+
Be cautious when using LoadFromText with complex queries involving subqueries, as it may occasionally result in corrupted queries. This method is unsupported but widely used by developers for advanced tasks like version control or automated deployments.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Application.SaveAsText
3+
TOCTitle: Application.SaveAsText
4+
ms:assetid: 7cf8dc49-8a68-450f-bdc1-a55bcf6d485c
5+
ms.date: 08/06/2024
6+
ms.localizationpriority: medium
7+
---
8+
9+
# Application.SaveAsText
10+
11+
**Applies to**: Access 2024, Access 2019
12+
13+
The Application.SaveAsText method in Microsoft Access allows you to export database objects (like forms, reports, macros, modules, or queries) into a text file. This can be useful for version control, debugging, or transferring objects between databases.
14+
15+
## Syntax
16+
17+
Application.SaveAsText _ObjectType_, _ObjectName_, _FileName_
18+
19+
## Parameters
20+
21+
|Parameter|Description|
22+
|:--------|:-----------|
23+
|_ObjectType_|The type of object you want to export (e.g., acForm, acReport, acQuery, etc.).|
24+
|_ObjectName_|The name of the object you want to export.|
25+
|_FileName_|The full path and name of the text file where the object will be saved.|
26+
27+
## Example
28+
29+
Here’s how you can save a form named "MyForm" to a text file:
30+
31+
```vba
32+
Application.SaveAsText acForm, "MyForm", "C:\Exports\MyForm.txt"
33+
```
34+
35+
## Remarks
36+
37+
The exported text file contains all the properties and definitions of the object. You can later use the Application.LoadFromText method to import the object back into a database. This method is particularly useful for developers who want to integrate Access objects into version control systems or share objects in a readable format.

0 commit comments

Comments
 (0)