If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Consistant error
I tried multiple different changes, but without any luck
maybe someone here can help out on what I am doing wrong. I keep getting a message: The changes you requested to the table were not successful because they could create duplicate values in the index, primary key, or relationship. Change the value in the fields or fields that contain duplicate data, remoce the index, or redifine the index to permit duplicate entries and try again. Now here is my code that I am using and I get seem to figure out what is wrong. vSSAN = Me.Parent.FMP.Column(0) & "/" & Me.Parent.SSAN & " " & Me.Parent.FName & " " & Me.Parent.LName End If Set dbs = CurrentDb() Set rst = OpenForSeek("tblFAM") rst.Index = "SSAN" rst.Seek "=", vSSAN If Not rst.NoMatch Then rst.Edit rst.Update rst.Close dbs.Close Else Set rst = dbs.OpenRecordset("tblFAM") rst.AddNew rst![SSAN] = vSSAN rst.Update rst.Close Me.Parent.FAMList.Requery End If |
#2
|
|||
|
|||
Consistant error
Never mind I fixed it for some reason it was trying to
create 2 records at the same time. I took out the following Set rst = dbs.OpenRecordset("tblFAM") rst.AddNew rst![SSAN] = vSSAN rst.Update rst.Close and it still created a record if needed. -----Original Message----- I tried multiple different changes, but without any luck maybe someone here can help out on what I am doing wrong. I keep getting a message: The changes you requested to the table were not successful because they could create duplicate values in the index, primary key, or relationship. Change the value in the fields or fields that contain duplicate data, remoce the index, or redifine the index to permit duplicate entries and try again. Now here is my code that I am using and I get seem to figure out what is wrong. vSSAN = Me.Parent.FMP.Column(0) & "/" & Me.Parent.SSAN & " " & Me.Parent.FName & " " & Me.Parent.LName End If Set dbs = CurrentDb() Set rst = OpenForSeek("tblFAM") rst.Index = "SSAN" rst.Seek "=", vSSAN If Not rst.NoMatch Then rst.Edit rst.Update rst.Close dbs.Close Else Set rst = dbs.OpenRecordset("tblFAM") rst.AddNew rst![SSAN] = vSSAN rst.Update rst.Close Me.Parent.FAMList.Requery End If . |
Thread Tools | |
Display Modes | |
|
|