【发布时间】:2021-03-15 07:55:46
【问题描述】:
我对访问知之甚少,但我试图复制一些编码,当我输入 Setfocus 时,它被忽略了我对编码知之甚少,但为什么我的访问不显示设置焦点
If IsNull(Me.txtStaffID) Or IsNull(Me.txtPassword) Then
MsgBox "You have not entered your Staff ID please do so"
Me.txtStaffID.BackColor = vbRed
Me.txtStaffID.SetFocus
Exit Sub
ElseIf IsNull(Me.txtPassword) Then
MsgBox "You have not entered your Password please do so"
Me.txtPassword.BackColor = vbRed
Me.txtPassword.SetFocus
Exit Sub
【问题讨论】:
-
当我输入 Setfocus 时,它会被忽略 这句话是什么意思? Access 会删除此字词吗?
-
附言。据我了解
txtStaffID和txtPassword是表单上的文本框。如果是这样,它们将永远不会为 NULL。你必须检查Me.txtTextBox.Text = ""。或者可能额外修剪 - 用户可能会输入很多空格...
标签: vba ms-access ms-access-2010 setfocus