S
Sharon
I have a main form frmMain, which has a subform - subfrm1 (continuous form),
which has a command button to open another form (continuous form) which
should show specific data related to the subfrm1.
The frmMain and subfrm1 are linked correctly by pkMain. The subform and the
form opened with the command button are linked by InstructionsID. The code
for the command button is below. The problem is that when I enter a new
instruction on the subform I get an error that there is a duplicate entry,
and it can't save the record.
Not sure why it is doing this? Any help is appreciated.
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "subfrm1"
stLinkCriteria = "[InstructionsID]=" & Me![InstructionsID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
which has a command button to open another form (continuous form) which
should show specific data related to the subfrm1.
The frmMain and subfrm1 are linked correctly by pkMain. The subform and the
form opened with the command button are linked by InstructionsID. The code
for the command button is below. The problem is that when I enter a new
instruction on the subform I get an error that there is a duplicate entry,
and it can't save the record.
Not sure why it is doing this? Any help is appreciated.
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "subfrm1"
stLinkCriteria = "[InstructionsID]=" & Me![InstructionsID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub