Hi, Sarah.
For an example, place a button on the main form and paste the following code
into the main form's module:
Private Sub SelRecBtn_Click()
On Error GoTo ErrHandler
Me!subformCtrlName.SetFocus
Me.Controls("subformCtrlName").Form.Requery ' Sets focus to 1st
record.
RunCommand acCmdSelectRecord
Exit Sub
ErrHandler:
MsgBox "Error in SelRecBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub ' SelRecBtn_Click( )
. . . where subformCtrlName is the name of the subform control, and
SelRecBtn is the name of the button. Save and compile the code, then open
the form in Form View. Navigate to any record except the first one on the
subform, then select the button on the main form. Focus will jump to the
first record and it will be selected. This will work even if the main form
is bound and has records displayed.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.