0
以下是宏偉的願景。訪問:以自定義格式打開現有記錄進行編輯
我正在構建將用於電子拆卸的零件數據庫。
當零件最初從PCB上取下時,其參考標誌和測量值將被記錄下來(每種零件類型都有自定義的輸入形式,例如電阻器,電容器,集成電路等)。稍後,我們將返回到每個部分並添加更多細節。
此時我可以從組合框中選擇現有零件,使用FindFirst函數在主表中找到它的記錄,提取相應的零件類型信息並打開相應的數據輸入表單。
我無法弄清楚的是如何在新打開的窗體中顯示該記錄。典型的Me.Bookmark = rs.Bookmark策略不工作,因爲我打開一個新的形式
Private Sub cmdEditPart_Click()
Dim rs As Recordset
Dim qdf As QueryDef
Dim prm As Parameter
Dim partType As String
Set qdf = CurrentDb.QueryDefs("Parts_SingleBoard")
qdf.Parameters(0) = Forms![Start Page (Boards)]![ComboPartNumber]
'Lookup record
If Not IsNull(Me.cmbRefDes) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = qdf.OpenRecordset.Clone
rs.FindFirst "[Reference Designator] = '" & Me.cmbRefDes & "'"
If rs.NoMatch Then
MsgBox "Part not found"
Else
'Display the found record in the appropriate form.
partType = rs.Fields("Part Type")
DoCmd.OpenForm (partType)
'Some sort of bookmark wizardy ****THIS IS WHAT I NEED HELP WITH *****
End If
Set rs = Nothing
End If
End Sub
4步回顧:現有部件的
查看列表 - >選擇部分 - >動態打開正確的數據輸入窗體 - >填寫表格我想編輯
沒有,三個逗號做了詭計。非常感謝! – user3358171