OK so you are going to write a whole new separate VFP application to use for the Backups?
This will indeed work, but it will not be 'sensitive' to only running when Record Changes and/or Deletes have been made.
And, as shown, it will not backup only those Changed or Deleted records.
Since you are new to VFP, I'd recommend that you spend some time watching the Free VFP tutorial videos at:
They will not specifically address Backups, but they will give you a general idea how to work with Data Tables, etc.
Also something to understand...
The command:
IF !USED("mid data") will only check if the Data Table in
USE within the same Program on that specific workstation.
But it will
NOT test if another user has the same table in
USE on a different workstation (no matter what FP/VFP program/application they are using).
You should also understand that some application usage requires that a Data Table be used EXCLUSIVELY and other uses will be as SHARED.
If someone has the Data Table in USE EXCLUSIVE, you will NOT be able to access it until they are done.
However is someone has the Data Table in USE SHARED (or just NOT EXCLUSIVE) then you can also access it concurrently fine.
One possibility would be to learn about and use the
ON ERROR approach to determine if you were NOT able to get access to a table and then handle it as desired. Within your VFP Development environment you can enter:
HELP ON ERROR Command and
HELP Error Messages Listed Alphabetically to see the list of error messages you might want to trap for.
Also here are a few examples:
Lastly you do not NEED to USE the tables EXCLUSIVE (although you can do so) in order to back them up.
It
would have the benefit of testing if someone else had the table in USE. If so, your own EXCLUSIVE access would be prevented.
Another couple of notes about the code you have posted.
Code:
IF !USED("open_end_defs")
USE "C:\Users\Treize\Desktop\Test_AH Open the set\open_end_defs.dbf" IN 0 ORDER Market EXCLUSIVE
ENDIF
I am not sure what you are trying to do with this.
You test one ALIAS (or table name) to see if it is in
USE
And then you look like you are trying to
USE a different table - although the code line shown will not work.
Another item is that you do not specifically show which table is SELECTED before you begin setting RELATIONS.
Yes, the last table Opened will be SELECTED, and if that is what you want, then OK, but personally I like to specifically use something like:
SELECT ParentTable
SET RELATION TO <whatever> INTO ChildTable ADDITIVE
Good Luck,
JRB-Bldr