Referencing a form in a tab control

A

Andy G

I have a form that contains a subform that acts as a navigation/search bar
for student info. On this same form I have a tab control; on one of the
pages of the tab control I have a form with student data. I would like to
click on a student record in the navigation/search in the subform and have
the form within the tab control go to the specific record displaying the
detailed student data. My problem is that I can't seem to find the form on
the tab control through my code in the navigation/search subform.

Thanks for the help.


Private Sub txtName_Click()

'Go to specific record
Dim stLinkCriteria As String
Dim frm As Form, rs As Recordset

Set frm = Forms("frmScholarQuick") 'This is where it is failing, it
can't find this form. This is the form I need to display the detailed
'student data
MsgBox frm.Name
Set rs = frm.RecordsetClone
stLinkCriteria = "[ScholarID]=" & ScholarID

rs.FindFirst stLinkCriteria
If rs.NoMatch Then
MsgBox "No match exists."
Else
frm.Bookmark = rs.Bookmark
End If

Set rs = Nothing
rs.Close

End Sub
 
R

rkc

Andy said:
I have a form that contains a subform that acts as a navigation/search bar
for student info. On this same form I have a tab control; on one of the
pages of the tab control I have a form with student data. I would like to
click on a student record in the navigation/search in the subform and have
the form within the tab control go to the specific record displaying the
detailed student data. My problem is that I can't seem to find the form on
the tab control through my code in the navigation/search subform.

Thanks for the help.
<snip code>

Forms that are contained in subform controls are not members of the
Forms collection. You have to reference the Form property of the
subform control.

Dim f as Access.Form
Set f = Me.subformControlname.Form
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top