Access Database Primary keys & indexes for multi t

Results 1 to 4 of 4

Thread: Access Database Primary keys & indexes for multi t

  1. #1
    MC Guest

    Default Access Database Primary keys & indexes for multi t

    Can anyone help me with the following error message? We have 3 tables with unique fileds and keys, indexed<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again. <BR><BR>/register02.asp, line 90 <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Access Database Primary keys & indexes for mul

    Not enough information to help much, but look for this. It looks like your trying to update an existing record in a table, but the sql is trying to insert a record in one of the 3 tables. post the SQL here for more help

  3. #3
    MC Guest

    Default Script for SQL to Insert into two tables-relations

    &#039Set up Insert into teh following tables LOGINOUT, MEMBER, & USERSTATUS to join relational tables via field **id_num01**<BR><BR>addsql1 = "INSERT INTO loginout (us_name01, p_word01, e_mail01, active_mem01) VALUES (&#039" & user & "&#039, &#039" & pass & "&#039, &#039" & mail & "&#039, 0)"<BR><BR>addsql2 = "INSERT INTO member (f_name01, m_in01, l_name01, address01, address01, city01, state01, zipcode01) VALUES (&#039" & first & "&#039, &#039" & middle & "&#039, &#039" & last & "&#039, &#039" & addr1 & "&#039, &#039" & addr2 & "&#039,&#039" & city & "&#039, &#039" & state & "&#039,&#039" & zip &"&#039) "<BR><BR>dbConn.Execute(addsql1)<BR>dbConn.Execute (addsql2)<BR>

  4. #4 Guest

    Default RE: Script for SQL to Insert into two tables-relat

    The problem is obviously that you are trying to insert the same index values as already in one of your tables. You apparently need to query your table to see if the index values already exist.<BR><BR>eg: If in your table loginout you have setup a unique index on "us_name01", and you are going to add a record with us_name01 equal to "J Smith", then you would need to do a query:<BR><BR>select * from loginout where us_name01 = "J Smith"<BR><BR>If this query returned no records then you can safely add the record. Otherwise you would need to perform some other action such as retrieve the record and update the other fields to new values, or warn the user that the information has already been entered. <BR><BR>This kind of thing could happen if the user hits the submit button on a form more than once, or if they submit the form and then use their browser&#039s back button to retun to the form page, and submit it again.<BR><BR>If you want more than one record to be added for each index, then you would need to remove the unique index and replace it with a duplicate index.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts