0
특정 콤보 상자 값이 내 컨트롤 집합에서 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
'나는 높은 가치를 지니고있다'는 것을 의미합니까?이 값은 변수에 할당 되었습니까? 아니면 지역 변수에 할당되어 있습니까? w? ... –
'MsgBox mdCount'에서 합리적인 범위 내에서 값을 얻지 못함 – methuselah
[8 개의 콤보 상자에 null을 제외하고 서로 일치하는 값이 있는지 확인] (http://stackoverflow.com/ 질문/27851145/check-to-see-if-8-comboboxes-values-that-match-one-another-exclude-nul) –