先设好组合框行来源,然后在组合框更新后事件写代码:
Dim I As Integer, strList As String
With 组合框名称
For I = 1 To .ListCount
strList = IIf(Nz(strList) = "", "", strList & ";") & .ItemData(I)
Next
If Nz(.Text) <> "" Then
If InStr(1, .Tag, .Text) = 0 And InStr(1, strList, .Text) > 0 Then
.Value = IIf(Nz(.Tag) = "", "", .Tag & "、") & .Text
End If
.Tag = .Text
Else
.Tag = ""
End If
End With
Private Sub 乡名_AfterUpdate()
Dim I As Integer, strList As String
With 乡名
For I = 1 To .ListCount
strList = IIf(Nz(strList) = "", "", strList & ";") & .ItemData(I)
Next
If Nz(.Text) <> "" Then
If InStr(1, .Tag, .Text) = 0 And InStr(1, strList, .Text) > 0 Then
.Value = IIf(Nz(.Tag) = "", "", .Tag & "、") & .Text
End If
.Tag = .Text
Else
.Tag = ""
End If
End With
End Sub
感谢各位的回复!!
我自己也找到一个解决方法:将组合框的行来源设为字段.value就可以了
总记录:5篇 页次:1/1 9 1 :