--- Jim MacDiarmid <[EMAIL PROTECTED]> wrote: > I'm looking for the best way to code this. I'm having a brain bubble today. > Here is the scenario: I have a list of records with 2 buttons in the last > column for edit and delete. The "userid" is passed as a parameter with the > click of these buttons. When I click edit, it brings up a form with some > pre-populated data with exception to 1 description field. The query behind > this form is joining with 2 tables. Lets say one table is the User data > table and the other is a custom table with userid, and user description. > When I click the submit button on this edit form, it should do an > insert/update on this custom table. My question is to I need to make sure > the user id I want to edit exists in this table, or will an update query add > the record if it doesn't exist? If I may also ask, what would be the best > way to code this? If my situation is not clear, please feel free to let me > know and I'll try to explain more.
An UPDATE query would fail if the record with the primary key does not exist. A REPLACE query is probably more helpful here. It's syntax is like INSERT. If you have any timestamp fields, they will be updated with either type of change. James