【问题标题】:Setting another field in access when the current field is changed更改当前字段时在访问中设置另一个字段
【发布时间】:2013-05-28 16:01:52
【问题描述】:

我有一个恼人的问题。当我在 Access 的一个字段中时,如果它被更改,我想将另一个字段设置为 null。因此,我在 Dirty 中有以下代码块,并命中了 Exit 事件。问题是它清除了另一个字段,然后“全选”了当前字段,而不是退出。如果我再次尝试退出,那么它会起作用,但不是第一次。

Private Sub EWId_Dirty(Cancel As Integer)
' Clear out the EID when this is changed.
  DirtyEWID = True
End Sub

Private Sub EWId_Enter()
  DirtyEWID = False
End Sub

Private Sub EWId_Exit(Cancel As Integer)
  If (DirtyEWID = True) Then
    Me![txtEID] = ""
    DirtyEWID = False
  End If
End Sub

【问题讨论】:

    标签: ms-access ms-access-2013


    【解决方案1】:

    我不知道我是否完全理解这个问题,但也许您可以在其中滑动 Me.txtEID.SetFocus?这样它就不会突出显示任何内容。

    【讨论】:

      【解决方案2】:

      我通过将更改移至“更新后”事件来使其工作。

      谢谢!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-06-15
        • 2020-06-05
        • 2017-05-07
        • 1970-01-01
        • 1970-01-01
        • 2019-11-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多