首先行来源有误,有重复项出现,应为SELECT DISTINCT [表1].[科目代号] FROM 表1;
查询按钮代码.List(tt)部分我也不清楚,excel中是这么写的,access中通不过!!
我想原理应该是这样的
Private Sub Command6_Click()
strWhere = ""
With Me.List0
For tt = 0 To .ListCount - 1
If .Selected(tt) Then
strWhere = strWhere & "([科目代号] like '" & .List(tt) & "') AND "
End If
Next
End With
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
Debug.Print strWhere
Me.查询1子窗体.Form.Filter = strWhere
Me.查询1子窗体.Form.FilterOn = True
End Sub
[此贴子已经被作者于2005-4-27 14:30:14编辑过] |