【发布时间】:2015-03-07 06:23:39
【问题描述】:
如果特定组合框值在我的控件集中出现超过 3 次(“md”),我会尝试触发事件。然而,目前,尽管我的 Access 表单上只有 8 个组合框,但我仍不断获得 32 或 40 之类的高值。我做错了什么?
Dim mdCount As Integer
For Each ctl In Me.Controls
If ctl.ControlType = acComboBox Then
Set cmb = ctl
If (currentDropDown.Value = cmb.Value) And (Not currentDropDown Is cmb) And (Not currentDropDown.Value = "md") Then
MsgBox "You cannot select the same value twice."
End If
If (currentDropDown.Value = "md") Then
mdCount = mdCount + 1
End If
End If
Next ctl
Set ctl = Nothing
Private Sub Submit_Click()
'MsgBox mdCount
If (mdCount > 2) Then
MsgBox "Error!"
Exit Sub
End Sub
【问题讨论】:
-
“我不断获得高价值”是什么意思?该值是否分配给变量?还是在本地窗口中?...
-
我在
MsgBox mdCount没有得到合理范围内的值 -
大概,这是转帖。
标签: ms-access combobox vba ms-access-2010