我在数据表视图中有一个带有子表单“ActivitiesSubform”的访问表单“DailyItemsTracked”。当我双击“ActivitiesSubform”中的记录时,它应该打开一个名为“ActivityEntry”的表单来编辑记录。
当我双击时,我有我想要编辑的记录的正确 ID。但是,新表单始终打开以添加新记录,而不是编辑现有记录。(所有现有记录都被过滤掉)。我在谷歌上搜索了一个多小时,但没有解决方案。
弹出表单上的 id 字段名称和 id 控制源都是“id”。
这是我尝试打开表单的方式:
MsgBox (Me![id]) 'It is getting the correct id for the selected record
DoCmd.OpenForm "ActivityEntry", , , "ID=" & Me.id
DoCmd.OpenForm "ActivityEntry", , , "[id]=" & Me![id]
DoCmd.OpenForm "ActivityEntry", , , "[id]=" & Form_ActivitiesSubform.id
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ActivityEntry"
stLinkCriteria = "[id]=" & Me![id]
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ActivityEntry"
stLinkCriteria = "ActivityEntryEdit.[id]= " & Me![id]
即使我明确地拼出 id ,它仍然会打开新记录:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ActivityEntry"
stLinkCriteria = "ActivityEntry.[id]= " & 69
打开后也不能选择记录
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ActivityEntry"
stLinkCriteria = "ActivityEntryEdit.[id]= " & Me![id]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms(stDocName).Recordset.FindFirst "id = " & Me!id
感谢您提供的任何帮助!