G
Guest
I am trying to create a button in Access 2000 that will either Save/Update
the record that was modified, or if the record does not exist in the table,
add it as a new instance.
I know how to add the button using the Wizard, but I am at a loss for the
code to add to make this happen. In theory, I can visualize this, but in
coding, all I get is errors. So here is my theory:
1) The user enters data into the blank text box, or selects a reecord from a
combo box and then modifies existing data within the text box.
2) The user clicks on the "Save" button
3) The action will search the table using the primary key; if there already
is a record using that primary key, the values from the text boxes will be
seen as an Update, and the record will be updated. If the search turns up
that there is no such record associated with the primary key value, then the
action will be handled as an Add Record / Insert, and the values will be
entered into the table as a new record.
So my problems boils down to my inexperience in Access coding. I have
previous experience in SQL and PL/SQL coding, and I tried to create a basic
If/Then/Else procedure, with an Update option and an Insert option, but all I
get is errors.
Please help....
the record that was modified, or if the record does not exist in the table,
add it as a new instance.
I know how to add the button using the Wizard, but I am at a loss for the
code to add to make this happen. In theory, I can visualize this, but in
coding, all I get is errors. So here is my theory:
1) The user enters data into the blank text box, or selects a reecord from a
combo box and then modifies existing data within the text box.
2) The user clicks on the "Save" button
3) The action will search the table using the primary key; if there already
is a record using that primary key, the values from the text boxes will be
seen as an Update, and the record will be updated. If the search turns up
that there is no such record associated with the primary key value, then the
action will be handled as an Add Record / Insert, and the values will be
entered into the table as a new record.
So my problems boils down to my inexperience in Access coding. I have
previous experience in SQL and PL/SQL coding, and I tried to create a basic
If/Then/Else procedure, with an Update option and an Insert option, but all I
get is errors.
Please help....