MS Access-未结合文本框的验证规则

发布于 2025-02-13 09:10:23 字数 270 浏览 3 评论 0原文

我在 formx 中有一个 textbox2 ,在我在 textbox1 中输入值后,使用afterupdate将其输入 textbox1 textbox2 是无界​​的文本框。

现在,我正在尝试在 textbox2 中为文本设置验证规则。如果TextBox2包含单词“ hold”,则应弹出一个消息框,说“无效条目”。

有可能吗?我在网上找不到任何参考。 有人可以帮忙吗? 谢谢你,

I have a Textbox2 in FormX which updates after I enter the value in Textbox1 using Afterupdate for Textbox1.
Textbox2 is unbounded text box.

Now I am trying to set up validation rule for the text in Textbox2. If Textbox2 contains word "Hold", it should pop up a message box saying "Invalid Entry".

Is it something possible? I could not find any reference online.
Can anyone please help?
Thank you,

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

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

发布评论

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

评论(1

红颜悴 2025-02-20 09:10:23

包括代码会很好,但是根据您所写的内容,我认为您可以在文本框1中将支票添加到文本框1中,该检查将文本写入文本框2之后,如果它无效,则会启动MSGBox,并且然后清除文本框1中的条目。

Private Sub Textbox1_AfterUpdate()
    If Textbox1.Value = "abc" Then
        Textbox2.Value = "hold"
    End If
    
    If Textbox2.Value = "hold" Then
        MsgBox "Invalid Entry", vbOKOnly, "Wrong!"
        Textbox1.Value = ""
    End If
End Sub

Including code would be nice, but based on what you wrote, I would think you could add a check to your after update event in textbox 1 that occurs after the text is written to textbox 2 that will fire off the msgbox if it is invalid and then clear the entry in textbox 1.

Private Sub Textbox1_AfterUpdate()
    If Textbox1.Value = "abc" Then
        Textbox2.Value = "hold"
    End If
    
    If Textbox2.Value = "hold" Then
        MsgBox "Invalid Entry", vbOKOnly, "Wrong!"
        Textbox1.Value = ""
    End If
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文