如何判断字段数据是否为包含关系?我们一般都用instr函数,它是返回某字符串在另一字符串中第一次出现的位置。
下面的示例我们从对比表中两个字段的值,判断其是否为包含关系
Public Function AinB(ByVal a As String, b As String) As Boolean
Dim Index As Integer
If Trim(a) <> "" And Trim(b) <> "" Then
For Index = 1 To Len(b)
If InStr(a, Mid$(b, Index, 1)) = 0
Then Exit Function
Next Index
AinB = True
End If
End Function