What is purpose of this db - performance evaluations? If this is the case, then people are evaluated, not positions. Position number should not be in both tblMeasure and tblUser. I think it should be in tblMeasure as this table appears to be a junction table to associate employee with position at time of evaluation. This will allow employee to occupy more than one position at different times due to promotion or transfer or rehire.
If MUserLoginID is the foreign key for UserID, why is there no relationship link to tblUser?
There are two procedures: btnDuplicate_Click and cmdDuplica_Click behind both frmManager and frmMMeasures. The button is associated with the first but the second has the code with the INSERT query. Neither reflects procedure code in original post.
However, I got this code behind frmManager to work:
Code:
Private Sub btnDuplicate_Click()
On Error GoTo Err_btnDuplicate_Click
Dim OldMeasureID As Integer, NewMeasureID As Integer
OldMeasureID = Me.MeasureId
'Add new record to end of Recordset Object.
With Me.RecordsetClone
.AddNew
!MUserLoginID = Me!MUserLoginID
!MeasureName = Me!MeasureName
!MPositonNumber = Me!MPositonNumber
!MeasureScore = Me!MeasureScore
!MAssBDate = Me!MAssBDate
!MAssEDate = Me!MAssEDate
NewMeasureID = !MainMeasureID
.Update
End With
CurrentDb.Execute "INSERT INTO tblSubMeasure(SubMeasureName, SubMeasureDesp, SubMeasureScore, SubMeasureWeight, SubMeasureTotal, MainMeasureID)" & _
"SELECT SubMeasureName, SubMeasureDesp, SubMeasureScore, SubMeasureWeight, SubMeasureTotal, " & NewMeasureID & " AS NewMeasureID " & _
"FROM tblSubMeasure " & _
"WHERE MainMeasureID=" & OldMeasureID & ";"
Me.MeasureName.SetFocus
DoCmd.GoToRecord , , acLast
Exit_btnDuplicate_Click:
Exit Sub
Err_btnDuplicate_Click:
MsgBox Error$
Resume Exit_btnDuplicate_Click:
End Sub