以连续形式标记记录

发布于 2024-08-12 23:08:07 字数 199 浏览 6 评论 0原文

在连续子表单中,我根据 DISTINCT 查询显示记录。因为它是不同的,所以每行包含记录 ID。

有谁知道添加复选框(或类似的)的方法,以便用户可以选择任何记录,然后将其用于通过代码创建新记录?

我更喜欢使用列表的子表单,因为它具有许多列排序和过滤功能。

MTIA

In a continuous subform, I display records based on a DISTINCT query. Because it's distinct, each row does not include a record ID.

Does anyone know of a way to add a checkbox (or similar), so that a user can select any of the records, which will then be used to create new records via code?

I prefer to use a subform to a list, as it features lots of column sorting and filtering functions.

MTIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如日中天 2024-08-19 23:08:07

根据创建记录所需的内容,类似此示例的内容可能适合:

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

Depending on what you need to create the records, something like this sample may suit:

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

Further information: http://support.microsoft.com/kb/208502

仅冇旳回忆 2024-08-19 23:08:07

仅供参考,我决定使用 Windows ListView OCX 控件,因为它提供了为每一行添加复选框的功能。

FYI, I decided to use the Windows ListView OCX control, as it offers the ability to add a checkbox for each row.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文