G
Guest
I the code that I am having the problem is listed below. The problem is that
when I go to save the record it says this message:
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, ore redefine the index to permit duplicate entries and try again.
I have checked the table to see if there is a field that does not allow
duplicates and they all do allow duplicates. It is brining up the error
message on the save statement. I check the tables to see if it is updated
and all of the information is updated except for the query
QueryAddDoneSession. Everything is placed into the tables correctly
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
save = True
'Call InterviewSession.OpenSession
' Dim sessionDate As Date
Dim qdfDone As DAO.QueryDef
Dim qdfStudyIdSSN As DAO.QueryDef
Dim qdfNextDate As DAO.QueryDef
Dim qdfRemindDate As DAO.QueryDef
If Check1 = True Then
DBEngine.BeginTrans
Set qdfDone = CurrentDb.QueryDefs("QueryAddDoneSession")
qdfDone.Parameters("newId") = Me.InterviewID
qdfDone.Parameters("newVisit") = 1
qdfDone.Execute
DBEngine.CommitTrans
Set qdfNextDate = CurrentDb.QueryDefs("QueryAddStatusNextDate")
qdfNextDate.Parameters("newId") = InterviewID
qdfNextDate.Parameters("newVisit") = 2 'schedule next interview
qdfNextDate.Parameters("newInterviewDate") = date + 112
qdfNextDate.Execute
qdfNextDate.Close
Set qdfRemindDate = CurrentDb.QueryDefs("UpdateReminderDate")
qdfRemindDate.Parameters("newId") = InterviewID
qdfRemindDate.Parameters("newVisit") = 1
qdfRemindDate.Parameters("newCallDate") = date + 90
qdfRemindDate.Execute
qdfRemindDate.Close
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
save = False
Call InterviewSession.CloseSession
End If
Form.Requery
Exit_cmdSave_Click:
Exit Sub
Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
End Sub
when I go to save the record it says this message:
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, ore redefine the index to permit duplicate entries and try again.
I have checked the table to see if there is a field that does not allow
duplicates and they all do allow duplicates. It is brining up the error
message on the save statement. I check the tables to see if it is updated
and all of the information is updated except for the query
QueryAddDoneSession. Everything is placed into the tables correctly
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
save = True
'Call InterviewSession.OpenSession
' Dim sessionDate As Date
Dim qdfDone As DAO.QueryDef
Dim qdfStudyIdSSN As DAO.QueryDef
Dim qdfNextDate As DAO.QueryDef
Dim qdfRemindDate As DAO.QueryDef
If Check1 = True Then
DBEngine.BeginTrans
Set qdfDone = CurrentDb.QueryDefs("QueryAddDoneSession")
qdfDone.Parameters("newId") = Me.InterviewID
qdfDone.Parameters("newVisit") = 1
qdfDone.Execute
DBEngine.CommitTrans
Set qdfNextDate = CurrentDb.QueryDefs("QueryAddStatusNextDate")
qdfNextDate.Parameters("newId") = InterviewID
qdfNextDate.Parameters("newVisit") = 2 'schedule next interview
qdfNextDate.Parameters("newInterviewDate") = date + 112
qdfNextDate.Execute
qdfNextDate.Close
Set qdfRemindDate = CurrentDb.QueryDefs("UpdateReminderDate")
qdfRemindDate.Parameters("newId") = InterviewID
qdfRemindDate.Parameters("newVisit") = 1
qdfRemindDate.Parameters("newCallDate") = date + 90
qdfRemindDate.Execute
qdfRemindDate.Close
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
save = False
Call InterviewSession.CloseSession
End If
Form.Requery
Exit_cmdSave_Click:
Exit Sub
Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
End Sub