access error please help

I

isaac_2004

hi am getting this error on my site that checks for shipping
information with a form field and checks the db with the querystring
values

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.


here is the code i use to open the shipping info from the database

'create SQL statement and open the database
strSQL = "SELECT tblCustomers.strEmail, tblCustomers.strFirstName,
tblCustomers.strLastName, tblCustomers.strAddress,
tblCustomers.strCity, tblCustomers.strState, tblCustomers.strZip " & _
"FROM tblCustomers "

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.open strSQL, objConn, , 3

response.write "strSQL:" & strSQL & "<br>"

'tests database for record, if none creates new column
If objRS.EOF then
objRS.AddNew
end if

'puts local variables into databse
objRS("strFirstName") = strFirstName
objRS("strLastName") = strLastName
objRS("strAddress") = strAddress
objRS("strCity") = strCity
objRS("strState") = strState
objRS("strZip") = strZip
objRS("strEmail") = strEmail
response.write(objRS("strEmail"))
-------------------------------------error thrown here
objRS.Update
-------------------------------------------
objRS.close
'Set objRS = nothing
'objConn.close
'Set objRS = nothing

thanks for the help
 
D

Douglas J. Steele

Does tblCustomers have a unique index defined for it? If so, does the data
you're trying to insert meet its uniqueness requirements?

Are there relationships between tblCustomers and any other tables? If so, do
the necessary entries exist in the related tables?
 
I

isaac_2004

Does tblCustomers have a unique index defined for it? If so, does the data
you're trying to insert meet its uniqueness requirements?

Are there relationships between tblCustomers and any other tables? If
so, do
the necessary entries exist in the related tables?

tblCustomers has a primary key at strEmail and there is no relation to
other tables, this error just appeared this site worked fine with this
code, the only thing i did was erase a field from the tbl that was
uneeded. i deleted it with access and reuploaded the db
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top