First of all check all your do loops. If there is code which is doing the something unnecessary, lop it off. eg.
For a screen form, many people put the @ row, col, say within the loop. This is unnecessary and can be moved out of and just before the start of the loop.
Variables should be declared with the minimum scope and lifetime so that the memory allocated to them is recovered as soon as their purpose is over. Declare variables as local as far as is practicable.
For fine tuning your programs, you could put the time() function at the start and after the end of major chunks, like do loops of your programs. This will let you know how long each section of your program takes. You can then critically examine each section of the program which takes the longest time (given the set of databases being used) and then try to optimise them one by one.
All the best.
Subra if you find this useful let me know at vksubra@usa.net