Subject Re: [IBO] resetting field values to their defaults
Author Jane Obenza
> I wouldn't allow it at all, of course...I would have a use-inaccessible
> generated key which gets written into the Insert buffer via
GeneratorLinks,
> or on post by a BeforeInsert trigger. If you have users entering an ID
> number then it's clearly because users have some influence over its
content
> and existence - a very strong reason *not* to use it as a key. It's a bit
> like using paint to hold the pieces of a building together.

My mistake again. I didn't mention that my ID number key field is just part
of the composite key of my table (along w/ another key field) and it is also
a foreign key (it's the primary key of another one of my tables). The user
can enter the ID number manually or look it up from a popup window; either
way, my code validates the ID number before the user can proceed entering
the values for the other fields. Having said that, I guess it's safe for me
to say that my design is quite ok? :)

To clarify, this is what happens when the user inserts a new record:
The user enters an ID number (or looks it up from a popup window), which is
then validated. If the ID number is valid then the user proceeds with
entering values for the rest of the fields. In the middle of this task,
let's say the user realizes that she's not using the right ID number for the
data she's entering, so she would then change the ID number she had entered
earlier to the correct ID number (at this point there is no posting yet;
still in insert mode). This is where I want to do the "resetting" stuff.
When the user changes the ID number to the correct one, I want all the other
fields to be reset to their default values (0), loosing the values
previously entered, that is, before the user realized her error.

I just wanted to see if there's a way to do this automatically rather than
by resetting all those fields to 0 *one by one* since I have *a lot* of
fields. I originally thought maybe the DefaultValues property could have
something to do with it, but as you said it only operates on inserts. From
what I gather in our exchange, I guess there's no "easy" way to do it but to
get started on that code :)

Thanks for the additional tips.


Jane