Use the ActiveControl property of the container and then parse out the alias and field name from the ControlSource property of the ActiveControl:
loControl = oForm.ActiveControl
lcAlias = SUBS(loControl.ControlSource, 1, (AT(".", loControl.ControlSource) - 1))
lcField = SUBS(loControl.ControlSource, (AT(".", loControl.ControlSource) + 1))
This is all you need for OLDVAL() and CURVAL()
WARNING Getting the ActiveControl from a grid requires a little extra work.
>How can I return the contents of a selected field without knowing the absolute alias or field name?
>
>I'm experimenting with commands that will eventually become an error handling routine. I want to see if I can save all pertinent info to an array and later copy it to an error history table.
>
>One thing I would like to save in the event of an update conflict is the OLDVAL(field(i)), CURVAL(field(i)) and the value of the field in the edit buffer, which the user may have changed. This last one causes the question. I haven't found any way to reference the edit buffer field except for 'tablename.fieldname'. Is there a way to do so using variables?
- Jeff