Intermittently receive create duplicate values error

  • Thread starter Lee Zard via AccessMonster.com
  • Start date
L

Lee Zard via AccessMonster.com

I have an unbound form with a combo box of Items built using (SELECT Items.
ItemID, Items.Desc FROM Items ORDER BY Items.ItemID) in the row source
property

I have a subform with a text box bound to Cost in the Items table. The data
in the subform is synchronized by the properties link child fields ItemID in
Items table and link master fields ItemID in combo box

My intention is for the user to be able to change the Cost and the underlying
Items table be updated. (I added Me.Requery to the the AfterUpdate event of
the Cost text box to redisplay the new Cost.)

Most of the time this works great. Occasionally I am getting “The changes
you requested to the table were not successful because they would create
duplicate values in the index, primary key, or relationshipâ€

What would make Access think I am trying to add something new as opposed to
updating existing data?

Thanks!
 
G

Guest

Since it is an unbound form, you will need to post the code where this
happens and identify the line on which it happens.
 
P

pireland via AccessMonster.com

The only code is the SQL select statement in the Row Source property of the
to combobox and the Me.Requery in the AfterUpdate property on the the text
box.
Since it is an unbound form, you will need to post the code where this
happens and identify the line on which it happens.
I have an unbound form with a combo box of Items built using (SELECT Items.
ItemID, Items.Desc FROM Items ORDER BY Items.ItemID) in the row source
[quoted text clipped - 16 lines]
 
G

Guest

Updating existing data could do it if somehow an index field that has to be
uinque has changed and there is another record in the record source that has
that value.
Because there is only the SQL and the unbound combo, I don't know if I could
isolate the problem for you.
My suggestion would be to see if you can purposely create the error.
--
Dave Hargis, Microsoft Access MVP


pireland via AccessMonster.com said:
The only code is the SQL select statement in the Row Source property of the
to combobox and the Me.Requery in the AfterUpdate property on the the text
box.
Since it is an unbound form, you will need to post the code where this
happens and identify the line on which it happens.
I have an unbound form with a combo box of Items built using (SELECT Items.
ItemID, Items.Desc FROM Items ORDER BY Items.ItemID) in the row source
[quoted text clipped - 16 lines]
 
P

pireland via AccessMonster.com

Thanks for your help. I will keep trying to find the sequence of events that
makes the error occur.

Updating existing data could do it if somehow an index field that has to be
uinque has changed and there is another record in the record source that has
that value.
Because there is only the SQL and the unbound combo, I don't know if I could
isolate the problem for you.
My suggestion would be to see if you can purposely create the error.
The only code is the SQL select statement in the Row Source property of the
to combobox and the Me.Requery in the AfterUpdate property on the the text
[quoted text clipped - 7 lines]
 
G

Guest

Good luck.
--
Dave Hargis, Microsoft Access MVP


pireland via AccessMonster.com said:
Thanks for your help. I will keep trying to find the sequence of events that
makes the error occur.

Updating existing data could do it if somehow an index field that has to be
uinque has changed and there is another record in the record source that has
that value.
Because there is only the SQL and the unbound combo, I don't know if I could
isolate the problem for you.
My suggestion would be to see if you can purposely create the error.
The only code is the SQL select statement in the Row Source property of the
to combobox and the Me.Requery in the AfterUpdate property on the the text
[quoted text clipped - 7 lines]
 

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

Top