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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error 3022

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I am getting the following error in my database: The changes you requested to the table were not successful because they would create duplicate values in teh 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 my code:
Dim JobProposal as DAO.Recordset
Dim db as database
Set db = CurrentDB()
Set JobProposal = db.OpenRecordset("SELECT * FROM JobProposal"*

JobProposal.AddNew
JobProposal.fields("Job_ID") = Job_ID
JobProposal.fields("InvoiceType_ID") = cboInvoiceType.Value
<<adding fields to the table>>
JobProposal.Update


I can't figure out why I am getting this error. In my JobProposal table, I only have one index value, JobProposal_ID which is set to an AutoNumber. I went through all of the values in my table and set them all to be indexed with &quot;Duplicates OK&quot;. There aren't even any JobProposals with the same Job_ID. I have removed all of the table relationships (in the table relationship wizard) that involve the JobProposal table. Can anyone help me figure out why I am getting this error message? Thanks!

 
Well I figured a way around it, I guess. I just made a new form, copied all my controls, form settings and code and it seems to work just fine. I've had this happen quite a few times where I will get some inexplicable error that I can't get around and that shouldn't be happening and if I just sort of start over with a new form, but all the same controls and code, the problem seems to get fixed. Weird.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top