【发布时间】:2015-10-01 10:12:19
【问题描述】:
我希望用户单击报告中的超链接,然后导航到位于子表单中的特定记录
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
【问题讨论】:
-
如果我将出现错误的行更改为:“Forms![BatchJ Form]![Journal Form].Form.Recordset.Bookmark = rst.Bookmark”然后我得到这个错误“not a valid书签”