Treme Treme - 1 year ago 81
Vb.net Question

Index error with RecordSet in VB.Net

I'm having a problem with

Recordset
in VB.net. I'm trying to copy data from one table to another one. The tables have a primary key and another index composed by two fields (for example
Color
and
HexValue
). This last index excludes nulls.

When i'm trying to update the Recordset after every record, the update fails because of the duplicate index.

For example I have these values:





1 Red Null
2 Yellow FFD700
3 Blue Null





The third record (
Blue
) fails.

The database is Access.

Can i solve this?

Answer Source

Yes you can fix it easily...

In your access application, get to the table designer window, there you should see the fields listed.

Make sure the FIRST field is your PRIMARY KEY, do not index the other fields unless its really necessary, and if it IS necessary then set the indexing properties for those fields to duplicates allowed.

See the image below enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download