Subject Re: [IBO] resetting field values to their defaults
Author Helen Borrie
At 02:14 PM 1/02/2003 +0800, you wrote:
>I have 1 key field and about 20 other fields for user entry. When the user
>changes the value in the key field, I want the values of the other 20 fields
>to reset back to their default values, which I have specified in my
>IB_Query's DefaultValues property.
>
>Is there a way to do this automatically using a particular method? I really
>hate to think of resetting all 20 fields manually :)

I guess the first thing you have to be aware of is that DefaultValues
operate in Insert mode, not Edit mode. You would have to write your own
code to force these values in response to something that happens in the row
during an Edit.

However, I'm really puzzled about why you want to do things this way. Keys
should not be editable. An "edit" that changes the key and sets all other
columns to default values isn't an edit - it's an insert. If you want a
new row to replace an existing row, have a sequence that inserts the new
row and deletes the one with the old key. That way, DefaultValues kick in
automatically, as designed, and the whole process is squeaky clean.

If you must make keys available to users for editing (not a feature of good
design!) then launch an insert...delete sequence when the key value change
is detected.

regards,
Helen