我希望用户点击报告中的超链接,然后导航到位于子表单中的特定记录
This线程通过使用Docmd.openform并传递OpenArg参数很有效,但是如果您想要更多功能或希望传递多个参数怎么办?
我在使用DAO的报告超链接字段中获得了以下代码:我无法正常工作:
Private Sub Text209_Click()
''open specific journal entry
DoCmd.OpenForm "BatchJ Form"
Forms![BatchJ Form]![Journal Form].SetFocus ''set focus to subform journal
''now find the journal entry
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
'Get the database and Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Journal Tbl", dbOpenDynaset)
'Search for the first matching record
rst.FindFirst "[Journal ID] = " & CLng(Me.CrJournal)
Forms![BatchJ Form]![Journal Form].Recordset.Bookmark = rst.Bookmark ''this line gives me an error: "Object doesn't support this object or method"
''cleanup
rst.Close
Set rst = Nothing
Set dbs = Nothing
End Sub
答案 0 :(得分:0)
你可能正在寻找这样的东西:
Private Sub Text209_Click()
Dim rst As DAO.Recordset
''open specific journal entry
DoCmd.OpenForm "BatchJ Form"
Forms![BatchJ Form]![Journal Form].SetFocus ''set focus to subform journal
''now find the journal entry
Set rst = Forms![BatchJ Form]![Journal Form].Form.RecordsetClone
'Search for the first matching record
rst.FindFirst "[Journal ID] = " & CLng(Me.CrJournal)
Forms![BatchJ Form]![Journal Form].Form.Bookmark = rst.Bookmark
''cleanup
rst.Close
Set rst = Nothing
End Sub