【发布时间】:2014-07-01 17:13:28
【问题描述】:
大家好,我处于两难境地我正在尝试找出一种方法来过滤掉列字段中的某些数据我知道如何做到这一点,但我不知道要使用的正确语法。首先是表格,这是我要编写的代码结构。
for i=1 to length of column First Match
for j=1 to length of column Second Match
If ((value of the data in column First Match = 15) OR (value of the data in column FirstMatch = 1)) AND
((value of the data in column Second Match = 15) OR (value of the data in column Second Match = 1))
Then
Filter the data and append so the filtered datas are saved for both First Match and Second Match
end if
next
next
我正在尝试过滤掉 15 和 1 的数据,以便仅显示值为 0,2,3,4,5,6...14 的数据,例如 john 和steve 不会显示,因为第一个和第二个匹配字段都有 1 或 15,但其余数据将显示我的表单是拆分表单设置。
我的方法正确吗?
First Name Last Name First Match Second Match
James Matheson 0 2
Monroe Labonson 4 3
Barack Obama 2 5
Frederick Douglas 3 4
Steve MCGowan 1 1
John Seals 15 15
Mike Omalley 14 15
Set rs = CurrentDb.OpenRecordset("Table1")
Do While Not rs.EOF
If rs!Fields("First Match") > 1 And rs!Fields("First Match") < 15 And rs!Fields("Second Match") > 1 And rs!Fields("Second Match") < 15 Then
End If
Loop
【问题讨论】:
-
我需要更多关于
ORs 和ANDs 在你的逻辑中的顺序的信息。括号是你的朋友。 -
现在问题更清楚了吗?
-
是的。我正在努力。