Conjunction 属性
优质
小牛编辑
133浏览
2023-12-01
全部显示
返回或设置一个 MsoFilterConjunction 常量,表示 ODSOFilters 对象中某个筛选条件与其他筛选条件的关系。可读写。
MsoFilterConjunction 可以为下列 MsoFilterConjunction 常量之一。msoFilterConjunctionAndmsoFilterConjunctionOrexpression.Conjunction
expression 必需。该表达式返回“应用于”列表中的对象之一。
示例
本示例更改已有筛选,从邮件合并中删除所有 Region 域不等于“WA”的记录。
Sub SetQueryCriterion()
Dim appOffice As Office.OfficeDataSourceObject
Dim intItem As Integer
Set appOffice = Application.OfficeDataSourceObject
appOffice.Open bstrConnect:="DRIVER=SQL Server;SERVER=ServerName;" & _
"UID=user;PWD=;DATABASE=Northwind", bstrTable:="Employees"
With appOffice.Filters
For intItem = 1 To .Count
With .Item(intItem)
If .Column = "Region" Then
.Comparison = msoFilterComparisonNotEqual
.CompareTo = "WA"
If .Conjunction = "Or" Then .Conjunction = "And"
End If
End With
Next intItem
End With
End Sub