I have a form with a Sub Form (SubFrmScores1) which is linked to the form using the field [LngCompetitorNo] in both Child and Master links.
I also have a combo box which is used to select a record in the Master form, using the following code:
The last line of the code is the DoCmd with which I am having problems. The Macro is set as follows:
GoToControl SubFrmScores1
GoToControl Score (This is a field in the sub form)
Without the DoCmd coding, the combo box will bring up the correct record every time but the focus does not move to the sub form. With the DoCmd code enabled, the focus moves to the sub form but, occasionally, fails and I receive one or other of the following error messages:
Run-Time error 2105 You can't go to the specified record
Or
Run-Time error 3105 No current record.
In each case, if I click the Debug button the DoCmd coding is highlighted.
The problem appears to be with the coding of the macro but I cannot see any other method of shifting the focus to the sub form.
Any assistance would be much appreciated.
Best Regards
John
I also have a combo box which is used to select a record in the Master form, using the following code:
Code:
Private Sub Combo36_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[LngCompetitorNo] = " & Str(Nz(Me![Combo36], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.RunMacro "GoToScore7"
End Sub
The last line of the code is the DoCmd with which I am having problems. The Macro is set as follows:
GoToControl SubFrmScores1
GoToControl Score (This is a field in the sub form)
Without the DoCmd coding, the combo box will bring up the correct record every time but the focus does not move to the sub form. With the DoCmd code enabled, the focus moves to the sub form but, occasionally, fails and I receive one or other of the following error messages:
Run-Time error 2105 You can't go to the specified record
Or
Run-Time error 3105 No current record.
In each case, if I click the Debug button the DoCmd coding is highlighted.
The problem appears to be with the coding of the macro but I cannot see any other method of shifting the focus to the sub form.
Any assistance would be much appreciated.
Best Regards
John