Backing up and Restoring Objects

There is an un-documented hidden method that VSS uses to export the objects through VBA. It's very simple to use. It  doesn't require any special references to be set.

 

Here is an example of a form object:

CODE TO SAVE

Application.SaveAsText acForm, "Customers", "C:\backups\forms\Customers.txt"


To load a form back in to access from a text file:

CODE TO LOAD

Application.LoadFromText acForm, "Customers", "C:\backups\forms\Customers.txt"
 

 

*** Warning *** When you use the .LoadFromText to import an object it will overwrite an object with the same name without any warning.

 

TIP 1: I use this to repair a form or report that has become corrupted. You can open the text file in Notepad and edit it. I do this to fix a report that has the printer object data corrupted. If this does not repair the object then you will need to restore the object from a backup or recreate it.
 
TIP 2: You can use this to make backups fo all your objects into a folder.
 
TIP 3: This can be used to create your own version control.