Hi,
I understand that from time to time, a database should be analyzed in order to keep it running efficiently.
The question I have is where should I put this code?
Is it better to put it in the window open event of the window containing the database / listbox, or should it be inserted after adding to or deleting from the database?
It’s a high cost maintenance operation. Not intended to be used after inserts/deletes. Just periodically. A good time to use it is when you “stop” to do some maintenance operations. After a successful backup seems a very appropriated time, if some crash happens you are covered. Backups are a daily job, analyzes could be a weekly job.