add vs update

  • Thread starter Thread starter Chrisx
  • Start date Start date
C

Chrisx

I have a form that uses a table as recordsource. Users
can modify existing records in the table or they can add
new ones.

The problem I have is as follows: I added combo box so
they can go immediately to the record that they want.
This is fine if they just want to modify it. But some of
them are trying to go to a particular record and use it as
a base for a new one. They try to change data in the
form, and think they are saving a new record, but are
really modifying the current one.

Is there some way using code that I can check, and if the
primary key field has changed, add a new record, otherwise
modify the existing one?

Thanks for any help.
 
Unfortunately, it is very difficult to idiot-proof an application. That's
because idiots are geniuses at screwing things up. What you are asking is
difficult in a bound form. It might be possible in an unbound form, but
that opens other areas of complexity.

What I would do is create two separate forms, one to Add new records and one
for Modifying records. This won't prevent them from screwing up existing
records, but if they know that the form is only for Modifying records, you
have hopes of training them not to use it to create new records.

Another possible strategy is to have just one form that is Locked on opening
and every time you move to a new record. Then the user must push a button
to choose either to Add a record or Modify an existing record. Pushing Add
allows them only to add (by setting the DataEntry property of the form to
Yes) and pushing Modify only allows modifications (by setting the Allow
Additions to No). This way they must push a button to acknowledge what they
are doing and again you have hopes of training them.
 
Roger,
Thanks for the possible strategies. I'm getting lots
of practice idiot-proofing things. I'm going to give
option 2 a try.
Thanks again.
 
Back
Top