如何在MS访问中的特定记录中链接复选框和按钮

发布于 2025-02-12 17:01:51 字数 454 浏览 0 评论 0原文

我将在MS访问表单中链接一个复选框和按钮。当不选中复选框时,该按钮将被禁用,并在选中该按钮时启用。 我已经写了行以运行此命令。但是结果并不令人满意。因为当我检查复选框时,所有相同的按钮都将启用。当我取消选中复选框时,所有按钮都会禁用。 (我的意思是,特定记录中的按钮和复选框之间没有链接。) 我的代码是:

private sub reqchooesed_click()

 If Me.reqChooesed = True Then
        Me.Command1.Enabled = True
    Else
        Me.Command1.Enabled = False
    End If
End Sub

[示例1] [1] [示例2] [2] [1]:https://i.sstatic.net/wnk9m.png [2]:https://i.sstatic.net/oaz6m.png

I am about to link a checkbox and a button in the MS Access form. the button becomes disabled when the checkbox is unchecked and becomes enabled whenever it is checked.
I have written lines to run this command. but the results are not satisfying. because all the same buttons become enabled when I check a checkbox. and all buttons become disabled when I uncheck a checkbox. (I mean there is no link between the button and the checkbox in a specific record.)
My code is:

Private Sub reqChooesed_Click()

 If Me.reqChooesed = True Then
        Me.Command1.Enabled = True
    Else
        Me.Command1.Enabled = False
    End If
End Sub

[Example 1][1]
[Example 2][2]
[1]: https://i.sstatic.net/wNk9M.png
[2]: https://i.sstatic.net/oaZ6m.png

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

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

发布评论

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

评论(1

我很OK 2025-02-19 17:01:51

使用后杜特事件:

Private Sub reqChooesed_AfterUpdate()

    Me!Command1.Enabled = Me!reqChooesed.Value

End Sub

但是所有记录都将行为相同。对于单个操作,请将复选框绑定到表中的新布尔字段,然后将按钮移至表单的标头或页脚。

Use the AfterUpdate event:

Private Sub reqChooesed_AfterUpdate()

    Me!Command1.Enabled = Me!reqChooesed.Value

End Sub

But all records will behave the same. For individual operation, bind the checkbox to a new Boolean field in the table, and move the button to the header or the footer of the form.

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