MS error for mysteriously duplicate records

DUX

Registered User.
Local time
Today, 04:21
Joined
Feb 3, 2003
Messages
31
Hello All, I am having tropuble with an asp page, but it seems to be database related, so i thought i would check here to see if anyone knows this problem. I am getting the following error and it appears that it is telling me that i am trying to enter a duplicate record into my database. i have run many many tests on this and can't seem to figure out why i get the error when i do. i make sure that the record does not already exist, i enter it and sometimes it gives me this error while it actually does enter the info into the database. the info flows to the database, but i sometimes get the error. it is almost like it i am hitting the submit button twice (super fast) on some occasions(or something), but i am not. i have entered the exact same information numerous times, sometimes it gives me this error and sometimes it says it was successful...then i go into the database and delete the record and try it again, each time it is a crap shoot as to whether it will work. does anyone recognize this error message from their own adventures?
ps-this is all being done on my developmental server, in case you were wondering.
also, i do delete the record after each attempt....but sometimes it gives the error and other times it succeeds. there is no rhyme or reason to why it works one time and why it doesn't the next...the info is exactly the same on each attempt.

Thanks,
Dux

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[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.


if it helps...MY CODE IS AS FOLLOWS:

objConn.Open "OPCR"
strSQL = "select * from OPCR where OPCRno = '" & trim(OPCRno) &"'"
set RS = objConn.execute(strSQL)
sqla = "Insert into OPCR (OPCRno, Priority, DocType, BSI, SysEng, DateReceived, Author, DateAssigned"
sqlb = ") values ('" & OPCRNo &"', " & Priority & ", " & DocType &", '"& BSI &"', '"& SysEng &"', #"& DateReceived &"#, "& Author &", #"& DateAssigned &"#"

if not DocNo = "" then
sqla = sqla & ", DocNo"
sqlb = sqlb & ", '" & DocNo &"'"
end if
if not RevisionNo = "" then
sqla = sqla & ", RevisionNo"
sqlb = sqlb & ", '" & RevisionNo &"'"
end if
if not RequestedBy = "" then
sqla = sqla & ", RequestedBy"
sqlb = sqlb & ", '" & RequestedBy &"'"
end if
if not Description = "" then
sqla = sqla & ", description"
sqlb = sqlb & ", '" & description &"'"
end if
strSQL = sqla & sqlb & ")"
 
What is the primary key for the table?
Are there any unique indexes?
 
MS Error

OPCRNo is the primary Key.
OPCRNo is set for Indexed: Yes (No Duplicates)
&
BSI is set for Indexed: Yes (Duplicates OK)

All of the rest are set to Indexed: No

Thanks,
Dux
 

Users who are viewing this thread

Back
Top Bottom