简体   繁体   English

需要一个弹出窗口 window 以连续形式仅第一次打开

[英]Need a popup window to open only the first time in a continuous form

I have a continuous form with a combobox with the control source of ProductID.我有一个带有 ProductID 控制源的 combobox 的连续表格。

I have the following vba code:我有以下 vba 代码:

Private Sub ProductID_AfterUpdate()
if (productID=1 or productID=2) then
docmd.openform "frminfo"
end if
End Sub

I want that popup window ("frminfo") to open ONLY the first time the condition is true.我希望该弹出窗口 window (“frminfo”)仅在第一次条件为真时打开。 How should I modify this?我应该如何修改这个?

Declare a boolean public variable or TempVar or use an UNBOUND textbox and set to True when the condition is met.声明 boolean 公共变量或 TempVar 或使用 UNBOUND 文本框并在满足条件时设置为 True。 Include value of whichever in the If condition.在 If 条件中包含任何一个的值。

Option Compare Database
Option Explicit
Public booTest As Boolean
____________________________________________________________________

Private Sub ProductID_AfterUpdate()
If (productID=1 Or productID=2) And booTest = False Then
    DoDmd.OpenForm "frminfo"
    booTest = True
End If
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM