Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Data List Problem

Status
Not open for further replies.

jfarrell

Technical User
Mar 3, 2001
15
US
If anyone can help me with this I would appreciate it.
I have a bound DataList (DataList1) Control bound to Adodc1.
Data Source Adodc1
Bound Column Empid
Data Field Empid
List Field LName
Row Source Adodc1
My code is as follows
Private Sub DataList1_MouseUp(....
Adodc1.Recordset.BookMark = DataList1.SelectedItem
end sub

The problem is when I click on a name in the Data list
I get the error "The change you requested to the table were
not successful because they would create duplicate values in the index, primarykey, or relationship. Change the data in the field that contain duplicate data, remove the index or redefine the index to permit duplicate entries.

Empid is the primary key in an Access table. There are no
duplicates in the Empid field but there are dups in the
Lname field.
Any suggestions.
Thanks
John

 
Dear John

are you using the list box JUST to select a record? If you are then you only need to set the listfield and rowsource propreties.

Because you have set BoundColumn/RowSource then the selected record is saved into the current record within the recordset, and it's probably that saving that's causing the error. This is a common problem wiht list boxes as you can use them just to list information from the db or to actually edit the db.

Also - you are much better off using the data environment (click project | Data Environment) than the data control to connect to a db - much more options.

Kate

 
Thankyou Kate for the solution. I am very grateful to you.
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top