1/12/2011

Archiving Fields in the Notes

I have a customer who wants to archive old data before they edit and change the value of certain fields. You can easily automate the archiving of various fields into one of the Notes fields by using a script. The example I'm using is archiving the Zoning District and the Existing Use fields in the Property Screen into the Notes1 field. The script copies the fields into the Notes when you click on the Script button while editing a Property record. This script uses "Base" for the Module, "Property" for the Screen, and "Left" for the Action:

if propscreen.isediting = .T.
replace notes1 with iif(empty(notes1),"",alltrim(notes1) +chr(13)+chr(13));
+ "ZONING ARCHIVED: "+dtoc(date()) + chr(13)+;
"Old Zoning: " + alltrim(zoning);
+"  Use: " + alltrim(exist_use)
propscreen.refresh
endif

In ZP 32 the "notes1" field should be referred to as "notes".