strSQL="SELECT * FROM Table"
if txtID.text<>"" then
bStart=true
strSQL=strSQL & " ID=" & txtID.text
endif
if txtName.text<>"" then
if bStart then
strSQL=strSQL & " AND Name=" & txtName.text
else
strSQL=strSQL & " Name=" & txtName.text
bStart=true
endif
strFind = "单位名称,处室,行政区,名字,电话"
strField = VBA.Split(strFind, ",", , vbTextCompare)
If Trim(txtIF.Text) = "" Then MsgBox "请输入查找的条件", vbInformation, "系统提示": Exit Sub
lngRsCount = m_adoRs.RecordCount '原有记录的个数
For i = 0 To UBound(strField)
m_adoRs.Filter = strField(i) & " like '%" & txtIF.Text & "%'"
If lngRsCount > m_adoRs.RecordCount And m_adoRs.RecordCount <> 0 Then '判断是否记录数有否改动来找到是否继续查找
Exit For
End If
Next i
If lngRsCount = m_adoRs.RecordCount Then
MsgBox "没有找到你所要的内容", vbInformation, "系统提示"
Else
'数据显示
End If