MS Access 根据子表单的焦点自动填充主表单

发布于 2024-08-06 05:27:13 字数 505 浏览 5 评论 0原文

我有一个带有两个组合框(名称和组)的数据输入/编辑表单。

  • 每个组与多个名称相关,但每个名称仅属于一个组。
  • 该表单的底部是一个子表单,它是一个连续表单 显示根据过滤的关联表的查询 您可以从中选择组的未绑定组合。

基本上,您选择要查看的组,它会显示该组中所有名称的列表。

我想让这个表单能够从表中添加删除名称(它已经使用按钮完成了),但我也希望能够选择 子表单中的名称,并使主表单聚焦于该条目并自动填充两个绑定的组合。

然后,我希望能够编辑保存该条目,或者只是删除该条目。

同样,我希望能够添加新条目,而不必担心覆盖当前条目。 Access 可能会自动执行此操作;如果是这种情况:

是否可以编辑条目而不删除然后替换它?

I have a data entry/editing form with two combo boxes (Name and Group).

  • Each Group correlates to multiple names but each name is in only one group.
  • At the bottom of this form is a subform which is a continuous form
    displaying a query of the associated table filtered based on an
    unbound combo from which you select the group.

Basically, you choose which group you want to see and it displays a list of all the Names in that Group.

I want to make this form able to add and delete Names from the table (which it does with buttons already), but I also want to be able to select a Name from the subform and have the main form focus on that entry and auto fill the two bound combos.

And then from there I would like to be able to edit and save that entry or just delete the entry.

Similarly, I would like to be able to add a new entry without worrying about writing over a current entry. Access might do this automatically; if this is the case:

Is it even possible to edit an entry without deleting and then replacing it?

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

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

发布评论

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

评论(1

别想她 2024-08-13 05:27:14

我还希望能够选择一个
子表单中的名称并具有
主窗体重点关注该条目和汽车
填充两个绑定的组合。

为此,您可以使用子表单中的 ID 对主表单的记录集执行 FindRecord。该表格将移至正确的记录。来自子表单的 OnCurrent 事件:

 Forms!MyMainForm.Recordset.FindFirst "MyID = " & desiredRecordID

 Forms!MyMainForm.Recordset.FindFirst "MyID = '" & desiredRecordID & "'"

同样,我希望能够
添加新条目而无需担心
覆盖当前条目。

为此,请执行以下代码:

 DoCmd.GoToRecord acDataForm, "MyMainForm", acNewRec

I also want to be able to select a
Name from the subform and have the
main form focus on that entry and auto
fill the two bound combos.

To do that, you can do a FindRecord on the main form's recordset, using the ID from the subform. The form will move to the correct record. From the subform's OnCurrent Event:

 Forms!MyMainForm.Recordset.FindFirst "MyID = " & desiredRecordID

or

 Forms!MyMainForm.Recordset.FindFirst "MyID = '" & desiredRecordID & "'"

Similarly, I would like to be able to
add a new entry without worrying about
writing over a current entry.

To do that, execute the following code:

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