我下载了也看不懂你想要什么。随便猜一下吧,剩下的你自己看帮助或者继续猜吧。
在按钮的click事件中添加代码如下。
docmd.runsql "select * from 销售数据 where 商品全名&分类 not like'*qx*' and 商品全名&分类 not like'*jg*' and 商品全名&分类 not like'*" & me.text15.value & "*' and 商品全名&分类 not like'*" & me.text17.value & "*' "
Private Sub Command91_Click()
Dim sql As String, str As String
str = "商品全名 not like '*qx*' and 商品全名 not like '*jg*' and 分类 not like '*qx*' and 分类 not like '*jg*'"
If Not (IsNull(Me.Text15)) Then
str = str & " and 商品全名 not like '*" & Me.Text15 & "*'" & " and 分类 not like '*" & Me.Text15 & "*'"
End If
If Not (IsNull(Me.Text17)) Then
str = str & " and 商品全名 not like '*" & Me.Text17 & "*'" & " and 分类 not like '*" & Me.Text17 & "*'"
End If
Me.销售子表.Form.Filter = str
Me.销售子表.Form.FilterOn = True
sql = "SELECT * INTO 销售数据1 FROM 销售数据 where " & str
DoCmd.SetWarnings True
DoCmd.RunSQL sql
End Sub