我有一个访问表单,它是通过从另一个表单单击按钮打开的。我有一个 Form_Current 事件,它通过 VBA 更新该表单上的几个控件。出于某种原因,这会导致在 Form_Current 完成后触发 BeforeUpdate 事件,即使 MS 帮助文档说在 VBA 中更改控件不会触发此事件。我已设法隔离至少一条将触发此事件的行:
txtEventID = gblEventID
其中 txtEvent ID 是控件的名称,gblEventID 是模块级变量。我无法弄清楚为什么会这样。有任何想法吗?
如果您想查看整个潜艇:
Private Sub Form_Current()
If (Me.NewRecord = True) Then
Dim lookupNum As Integer
txtEventID = gblEventID
lookupNum = DLookup("Max(Subplot_Num)", "tbl_Subplots", "Event_ID = " & txtEventID.Value) + 1
If (IsNull(lookupNum)) Then
txtSubplotNum = "1"
Else
txtSubplotNum = lookupNum
End If
End If
If xboPoaching.Value = False Then txtPoachingNotes.Enabled = False
End Sub