B
Barth Wilsey
I am trying to work on the same record when switching to a new form using
the code below
The [MedRec] field is being transferred but when I leave the second form, a
dialog box appears telling me that I cannot save the record because if would
cause duplicate entries in the key field [MedRec]. Believing that the
problem is that the second form is going to a new record, I have tried to
set the AllowAdditions method off. When I do this, the second form appears
blank. Any help would be appreciated. Thanks in advance
Private Sub cmdOpenListOpioids_Click()
On Error GoTo Err_cmdOpenListOpioids_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAge"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[MedRec]=" & "'" & Me![txtMedRec] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenListOpioids_Click:
Exit Sub
Err_cmdOpenListOpioids_Click:
MsgBox Err.Description
Resume Exit_cmdOpenListOpioids_Click
End Sub
the code below
The [MedRec] field is being transferred but when I leave the second form, a
dialog box appears telling me that I cannot save the record because if would
cause duplicate entries in the key field [MedRec]. Believing that the
problem is that the second form is going to a new record, I have tried to
set the AllowAdditions method off. When I do this, the second form appears
blank. Any help would be appreciated. Thanks in advance
Private Sub cmdOpenListOpioids_Click()
On Error GoTo Err_cmdOpenListOpioids_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAge"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[MedRec]=" & "'" & Me![txtMedRec] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenListOpioids_Click:
Exit Sub
Err_cmdOpenListOpioids_Click:
MsgBox Err.Description
Resume Exit_cmdOpenListOpioids_Click
End Sub