Treme Treme - 2 years ago 101 Question

Index error with RecordSet in VB.Net

I'm having a problem with

in 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
). 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 (
) 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