Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Access 2024, Access 2019
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, which exports database objects to text files. These methods are particularly useful for version control, backups, or transferring objects between databases.
Syntax
Application.LoadFromText ObjectType, ObjectName, FileName
Parameters
| Parameter | Description |
|---|---|
| ObjectType | The type of object (e.g., acForm, acReport, acQuery, etc.). |
| ObjectName | The name of the object to be imported. |
| FileName | The full path to the text file containing the object definition. |
Example
Here’s how you can import a form that was saved as a text file.
Application.LoadFromText acForm, "MyForm", "C:\Backup\MyForm.txt"
Remarks
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.