Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Compressing databases with a macro or script

Last updated: 3 Mar 2007 by

First, read article 'Reducing ("Compressing") the size of a database file' in this FAQ.

Since compression of database files (Dbase or .dbf type) may need to be done regularly it is a good idea to automate the procedure.

You cannot do this with macros in Approach v2.01 and v3.0*, however you can achieve the same result with these versions by using "Recorder" that comes with MS-Windows (look in the main or accessories folders). The key strokes from v3.0* are: ALT T P TAB 5 which takes you to the compression and where you can select the files. (This paragraph was not reviewed by because those older versions are no longer installed in our offices.)

The rest of this articles applies to v96 and later:

Here is a couple of examples:

If you want to use a macro to compress a particular database then put the following into a macro:

Up to v9.1:
    SendKeys ~%{F}UA{TAB 4}{RIGHT 4}{TAB}dbasename~{TAB 2}~

v9.5 and later versions:
    SendKeys ~%{F}UA{TAB 4}{RIGHT 3}{TAB}dbasename~{TAB 2}~

... where dbasename is the name of the database, or at least the minimum number of characters of the name needed to uniquely identify it.

The following script will compress one table (i.e. the first table in the list of databases):

'Up to v9.1:
Sub CompressTables
        Sendkeys "~%{F}UA{TAB 4}{RIGHT 4}{TAB 4}~{TAB 2}~",True
End Sub

'v9.5 and later versions:
Sub CompressTables
        Sendkeys "~%{F}UA{TAB 4}{RIGHT 3}{TAB 4}~{TAB 2}~",True
End Sub

For every additional database the you want to compress, insert the one repetition of the following code into the script immediately BEFORE the {TAB 2)~:

        {TAB 7}{DOWN}{TAB 2}~

So, to compress four databases in v9.5 and later versions of Approach the script would look like:

Sub CompressTables
Sendkeys "~%{F}UA{TAB 4}{RIGHT 3}{TAB 4}~{TAB 7}{DOWN}{TAB 2}~{TAB 7}{DOWN}{TAB 2}~{TAB 7}{DOWN}{TAB 2}~{TAB 7}{DOWN}{TAB 2}~{TAB 2}~",True

End Sub

You can find out the number and order of the tables in your APR using FILE/APPROACH/FILE PROPERTIES menu item.

If all this is a bit much, then you might want to consider purchasing DBFPack from which does it all for you.

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.