In a script, Set field [YourTable::field2 ; yourTable::Field1]
will do the job. OnObjectSave on Field1 should automtically copy the value each time you enter a different value into field1 and exit the field. OnObjectExit, OnObjectValidate should also work.
If you only want this to happen when you use the keyboard to exit the field, (not when clicking with the mouse), you can use OnObjectKeystroke and check for the code of the key pressed to exit the field. You can look up Code in FileMaker help to get the ascii code for return, enter and tab (all of which can exit your field depending on your field's behavior settings) If the key is pressed, do the set field to copy the date.
Wow, you're correct as always. :)
Yes, it worked!!!!
I'm a bit confused by Set Field vs Replace Field and when to use each.
Is there a reference for these with examples? My only FMP book isn't that clear on the distinction.
Set field modifies the value of the field in the current record or a single record linked to the current record via a relationship.
Replace Field Contents modifies the value of a field for every record in the current found set. Thus, this is a powerful tool that can update a lot of data in a single "batch" operation. It can't be undone and can eaily run afoul of edit locks on a shared database, so it's one to read up on in FileMaker help and it's a good idea to make a back up copy of your file just before trying it out when you first work with this tool to see what it does.
Thanks very much.
Have you ever thought of writing a book on FMP?
Your writing style is easy to read and understand yet technical enough without being overly so. :)