我正在尝试编写一些SQL,它确实需要一个类似于此字符串和该字符串的数组等等,并满足日期时间条件并使此语法正常工作。所有这些都是伪造的。 例如 [DueDate]> = someDateTimeControl.Value和[Place]类似" A"," B"," C"
因此,只显示在截止日期符合条件的地方,A,B,C。 我尝试使用AND [Place]像" A"或[Place]与" B" ...(依此类推)与DueDate但它会获得那些不符合截止日期的地方。那么你如何排列它以便我可以得到满足时间的集合中的时间和地点?
Private Sub Text168_AfterUpdate()
Dim membershipCutoff As String
Dim checkForAll As String
checkForAll = Me.Combo164.Value
If checkForAll = "All" Then
membershipCutoff = "Select * from [Members]"
ElseIf checkForAll = "All Members" Then
membershipCutoff = "Select * from [Members] where ([Expire] >= #" & Me.Text168 & "# And ([MembType] Like IN ('A' , 'B', 'C' , 'D') And [MembType] Not Like 'E'))"
Else
membershipCutoff = "Select * from [Members] where ([Expire] >= #" & Me.Text168 & "# And [MembType] = '" & Me.Combo164 & "')"
End If
Me.Members_subform.Form.RecordSource = membershipCutoff
Me.Members_subform.Form.Requery
End Sub
答案 0 :(得分:1)
like in
无效。你应该使用它们中的任何一个。您应该将其替换为and
或or
条件。
Select * from [Members]
where [Expire] >= #" & Me.Text168 & "#
And [MembType] IN ('A' , 'B', 'C' , 'D') And [MembType] <> 'E'
如果您要搜索模式,请考虑使用like
。对于您要做的事情,in
就足够了。