我在数据表视图中有一个Access表单“DailyItemsTracked”,子窗体“ActivitiesSubform”。当我双击“ActivitiesSubform”中的记录时,它应该打开一个名为“ActivityEntry”的表单来编辑记录。
当我双击时,我有我想要编辑的记录的正确ID。但是,新表单始终打开以添加新记录,而不是编辑现有记录。 (过滤掉所有现有记录)。我用Google搜索了一个多小时的问题,但没有解决方案。
弹出窗体上的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
感谢您提供的任何帮助!