If ( code ( Get ( TriggerKeystroke ) ) = 9 or //Tab Key
code ( Get ( TriggerKeystroke ) ) = 10 or // Enter
code ( Get ( TriggerKeystroke ) ) = 13 // Retun
Get ( TriggerKeystroke ) returns the actual character, not its character code
Why not just use OnObjectExit. Then when they hit tab, enter or return, it will perform the script.
What you're really looking for, if you want to try it your way is
Code(Get(triggerkeystroke))=9 or Code(Get(triggerkeystroke))=10 or Code(Get(triggerkeystroke))=14)
Perform Script < your script>
edit: oops, Phil types faster
And there's a difference in OnObjectExit. If you click elsewhere on the layout, OnObjectExit is tripped where the keystroke trigger is not. This can result in unwanted behavior when, say, you click a button to do an entirely different task.
(I sometimes use this keystrokeTrigger based method to create a "smart tab order" where the script uses the data just entered to determine where to put the focus next. (Weighmaster enter's customer DR license and customer info is looked up -- this is a repeat customer, put the cursor in the first field for recording transaction info or Customer fields at this point are blank -- this is a new customer, put the cursor into customer info fields...)
Thanks everyone - I just forgot to put the "Code" in. It works great now...