在连续子表单中,我根据DISTINCT查询显示记录。因为它是不同的,所以每一行都不包含记录 ID。
有谁知道添加复选框(或类似)的方法,以便用户可以选择任何记录,然后这些记录将用于通过代码创建新记录?
我更喜欢对列表使用子表单,因为它具有许多列排序和过滤功能。
MTIA
根据创建记录所需的内容,此示例可能适合:
Function DisplaySelectedCompanyNames()
Dim i As Long
Dim F As Form
Dim RS As Recordset
'' Get the form and its recordset.
Set F = Forms![Customers1]
Set RS = F.RecordsetClone
'' Move to the first record in the recordset.
RS.MoveFirst
'' Move to the first selected record.
RS.Move F.SelTop - 1
'' Enumerate the list of selected records presenting
'' the CompanyName field in a message box.
For i = 1 To F.SelHeight
MsgBox RS![CompanyName]
RS.MoveNext
Next i
End Function
更多信息: http: //support.microsoft.com/kb/208502
仅供参考,我决定使用 Windows ListView OCX 控件,因为它可以为每一行添加一个复选框。