Private Sub cmd查询_Click()
On Error GoTo Err_cmd查询_Click
Dim strWhere As String
strWhere = ""
If Not IsNull(Me.地区) Then
strWhere = strWhere & "([地区] like '*" & Me.地区 & "*') AND "
End If
If Not IsNull(Me.公司名称) Then
strWhere = strWhere & "([公司名称] like '*" & Me.公司名称 & "*') AND "
End If
If Not IsNull(Me.公司地址) Then
strWhere = strWhere & "([公司地址] like '*" & Me.公司地址 & "*') AND "
End If
If Not IsNull(Me.联系人) Then
strWhere = strWhere & "([联系人] like '*" & Me.联系人 & "*') AND "
End If
If Not IsNull(Me.联系方式) Then
strWhere = strWhere & "([联系方式] like '*" & Me.联系方式 & "*') AND "
End If
If Not IsNull(Me.机型) Then
strWhere = strWhere & "([机型] like '*" & Me.机型 & "*') AND "
End If
If Not IsNull(Me.出厂机型) Then
strWhere = strWhere & "([出厂机型] like '*" & Me.出厂机型 & "*') AND "
End If
Debug.Print strWhere
Me.资料查询子窗体.Form.Filter = strWhere
Me.资料查询子窗体.Form.FilterOn = True