Home > Software engineering >  Programmatically find and navigate to record on subreport in MS Access using VBA?
Programmatically find and navigate to record on subreport in MS Access using VBA?

Time:12-30

In Access, I can navigate to a record in a subform by using code similar to:

Dim rs As Recordset
Set rs = Me.Form.RecordsetClone
rs.FindFirst "CodeID = " & MyID
Me.Form.Bookmark = rs.Bookmark

Is there any way to do something similar with subreports, or any other way to navigate to a record within a subreport without using filters to only show one record? I'm looking to still be able to see the other records in the report, having the focus jump to the relevant record.

CodePudding user response:

I figured out a way to do it. Assuming the report is embedded as a subreport:

Me.rptTest.SetFocus
DoCmd.SearchForRecord , "", acFirst, "[IDField] = " & RelevantID
  • Related