|
- Private Sub asdfas_BeforeUpdate(Cancel As Integer)
- Dim intCount As Integer, H As Integer
- Dim I As Integer, J As Integer, K As Integer
- Dim strArray() As String
- intCount = Len(Me.asdfas.Text)
- If intCount Mod 2 <> 0 Then
- MsgBox "请输入偶数位的数据"
- Cancel = True
- End If
- H = intCount / 2 - 1
- ReDim strArray(H)
- For I = 0 To intCount - 2 Step 2
- strArray(J) = Mid(Me.asdfas.Text, I + 1, 2)
- J = J + 1
- Next
- K = UBound(strArray)
- For I = 0 To K
- For J = 0 To K
- If I <> J Then
- If strArray(I) = strArray(J) Then
- MsgBox strArray(I) & " 有重复"
- Cancel = True
- Exit Sub
- End If
- End If
- Next
- Next
- End Sub
复制代码 |
|