Dim StrWhere As String
Dim StrWords() As String
Dim i As Integer
StrWords() = Split(inp, " ")
For i = 0 To UBound(StrWords)
StrWhere = StrWhere & "[客户] & [合同号] & [产品名称] & [数量]" & " Like '*" & StrWords(i) & "*' and "
Next
If Len(StrWhere) > 0 Then
StrWhere = Left(StrWhere, Len(StrWhere) - 5)
End If
result.RowSource = "SELECT 订单.id, 订单.客户, 订单.合同号, 订单明细.产品名称, 订单明细.数量, [客户] & [合同号] & [产品名称] & [数量] AS 合并 FROM 订单 INNER JOIN 订单明细 ON 订单.id = 订单明细.上级id WHERE " & StrWhere
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |