Hello all,
I have this code running on a command button from the first form
And this code running in the on current event of the form which opens:
The code has been entered so that when I open the form in Add Mode, the 3 fields I've entered copy across to the new record.
The code actually works for adding a record, however, when you try and open the form in any other way, with a link criteria or the full version it displays no data, just the form header.
The form which is opening is based on a query of a juntion table and the two linked tables. The same method works perfectly for a different form based on a query with a junction table and two linked tables but only has two split openargs using the same code (without the extra field).
I believe the error message when clicking on a command button which opens the form via a link criteria specifies the second code shown above on the opening form as the problem.
Is the code wrong when entering 3 fields for a openargs split? Or is it something else?
Any help would be much appreciated,
Leigh
I have this code running on a command button from the first form
Code:
Private Sub btn_OpenSubEvidence_Click()
On Error GoTo Err_btn_OpenSubEvidence_Click
Dim stDocName As String
stDocName = "frm_SubEvidence"
DoCmd.OpenForm stDocName, , , "[SubArgIDFK]=" & Me.[SubArgID], acFormAdd, , Me.[SubArgID] & "|" & Me.[Argument] & "|" & Me.[SubArgument]
Exit_btn_OpenSubEvidence_Click:
Exit Sub
Err_btn_OpenSubEvidence_Click:
MsgBox Err.Description
Resume Exit_btn_OpenSubEvidence_Click
End Sub
Code:
Private Sub Form_Current()
If Me.NewRecord Then
Me.[SubArgIDFK] = Split(Me.OpenArgs, "|")(0)
Me.[Argument] = Split(Me.OpenArgs, "|")(1)
Me.[SubArgument] = Split(Me.OpenArgs, "|")(2)
End If
End Sub
The code actually works for adding a record, however, when you try and open the form in any other way, with a link criteria or the full version it displays no data, just the form header.
The form which is opening is based on a query of a juntion table and the two linked tables. The same method works perfectly for a different form based on a query with a junction table and two linked tables but only has two split openargs using the same code (without the extra field).
I believe the error message when clicking on a command button which opens the form via a link criteria specifies the second code shown above on the opening form as the problem.
Is the code wrong when entering 3 fields for a openargs split? Or is it something else?
Any help would be much appreciated,
Leigh
Comment