0
我在數據表視圖中使用了子窗體「ActivitiesSubform」的Access窗體「DailyItemsTracked」。當我在「ActivitiesSubform」中雙擊一條記錄時,應該打開一個名爲「ActivityEntry」的表單來編輯記錄。打開MS Access子窗體編輯特定記錄
當我雙擊時,我有我想要編輯的記錄的正確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
我很感激您可以提供的任何幫助!
戴爾,完美!謝謝。 – MrMoxy 2013-02-15 05:22:23