In a recent post @Ratslinger pointed to an interesting backup macro found in the Base documentation starting on on page 63.
Unfortunately the suggested macro comes with scant documentation on how it works, and one glaring syntax error that further confused me.
Start by correcting the syntax error, from:
...FOR k = 1 TO inMax - 1 TO 1 STEP -1...
to this:
...FOR k = inMax - 1 TO 1 STEP -1...
.
i.e. you can’t have more than one TO
clause in a FOR
statement.
With my comments added to help you understand how it works here is the code from the manual. I found it instructive: Databasebackup.odt
Wide load tip: Cut and paste into your wide screen programmer’s editor. I like: Kate or Notepadqq (linux) or Notepad++ (windows). Set tabs to 4 columns, use fixed width font. These editors allow quick and easy block indenting and out-denting with tabs. I use Kate most of the time but the latest version of Notepadqq allows converting tabs to spaces or the reverse.
Also, sorry, I know .odt isn’t a very good way to transport code between us, but Ask.LibreOffice.org won’t accept other formats, like .txt or .bas, and I can’t paste it below without it messing up line wrapping, for some unknown reason to be addressed another day. Suggestions for how to share code better, but without abandoning tabs or wide code are welcome.