update method

S

Shree

Hi!
I have a unique situation.
I have 2 tables. One unbound form.
There are 10 fields in the form. 9 fields need to go to
tblONE and one field needs to go to tblTWO.
tblTWO already has the record with a uniqe id.(Say 1111).
One of the fields of this record(1111) is the field that
needs to come from the 'unbound form.'
I am using 'Addnew - .update' for sending data to tblONE
since I am creating a brand new record in this table for
(1111). How do I update the remaining one field from this
form to tblTWO where the record already exixts but just
needs data coming in to the required field. I tried 'Edit -
.update' method but am getting an error. Please help.
Thanks in advance for any kind of help!
Shree
 
A

Alex Dybenko

what error you get?
you can also use update query to update tblTWO
but edit-update also ok
 
S

Shree

The error says "changes requested to the table are not
successful because it will create duplicate values in
index, primary key or relationship" its Error no 3022.
tblTwo already has this record. In the vba code that I am
writing, I am sending the id too. maybe that is why I am
getting this error. But how do i send the data to the
right record without specifying the id it needs to go to?
Please help!
 
G

Gary Miller

Shree,

If in the second table recordset, you are doing a FindFirst
to get the right record, your Edit/Update should do fine as
long as you don't try to edit the ID. You should only be
editing or modifying the one field that you need to .

Gary Miller
Sisters, OR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Moving data between tables 1
Code Syntax Help 6
Relationships 1
Adding New records in multiple tables 2
Union Query??? 1
Append Queries and Autonumbers 2
How to insert into two tables? 1
Updating "Bad" Records 1

Top