K
Kurt
I'm trying to open a form that has a subform and make it
navigate to a specific record on the subform, based on a
value in the form that I'm coming from. The form I'm
coming from shows a few fields from a query, and the users
want to click on any record and go to a form/subform
showing more details of the record they are on.
The record they click on is actually a record in a subform
of the form that opens, so I think I need to open the
form, navigate to the correct form record, then navigate
to the correct subform record (unless there's a better
way?)
I can open a form and navigate to a form record using:
Dim varRecord1_id As String
varRecord1_id = Me![Record1_ID]
stDocName = "View Details"
stLinkCriteria = "[Record1_ID]=" & "'" & varRecord1_id
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
My problem is that I can't get the subform to then
navigate to a specific record ( I can pass the id,
record2_id, for it). I tried this (below) and get the
error "Run-time error '438' Object doesn't support this
property or method", it stops on the "Set rs" line:
'Find the subform record.
Dim rs As Object
Set rs = Forms![View Details]![View Details
Subform1].Recordset.Clone
rs.FindFirst "[SubRecord_ID] = '" & varSubRecord_id & "'"
Me.Bookmark = rs.Bookmark
I'm not an experienced VBA programmer. I copied and
modified the above from a wizard-created combo box that
navigates to the selected record.
I think I'm close, can anyone please help?
Thanks,
Kurt
navigate to a specific record on the subform, based on a
value in the form that I'm coming from. The form I'm
coming from shows a few fields from a query, and the users
want to click on any record and go to a form/subform
showing more details of the record they are on.
The record they click on is actually a record in a subform
of the form that opens, so I think I need to open the
form, navigate to the correct form record, then navigate
to the correct subform record (unless there's a better
way?)
I can open a form and navigate to a form record using:
Dim varRecord1_id As String
varRecord1_id = Me![Record1_ID]
stDocName = "View Details"
stLinkCriteria = "[Record1_ID]=" & "'" & varRecord1_id
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
My problem is that I can't get the subform to then
navigate to a specific record ( I can pass the id,
record2_id, for it). I tried this (below) and get the
error "Run-time error '438' Object doesn't support this
property or method", it stops on the "Set rs" line:
'Find the subform record.
Dim rs As Object
Set rs = Forms![View Details]![View Details
Subform1].Recordset.Clone
rs.FindFirst "[SubRecord_ID] = '" & varSubRecord_id & "'"
Me.Bookmark = rs.Bookmark
I'm not an experienced VBA programmer. I copied and
modified the above from a wizard-created combo box that
navigates to the selected record.
I think I'm close, can anyone please help?
Thanks,
Kurt