如何连接记录集变量以使用过滤方法 - Vba

How concatenate recordset variables to use filter method - Vba

我想在我的记录集过滤器上连接多个变量。这里有更多信息:

但我不能。我试过了:

space = " "
rs.Filter = "[titre+ space + Nom] = '" & oLookFullName & "' and nomEntreprise = '" & objContact.CompanyName & "'"
Concatenation = rs!titre + " " + rs!Nom
rs.Filter = "Concatenation = '" & oLookFullName & "'"

有什么想法吗?

                                         EDIT

@Gustav,我用 split 尝试了你的代码,似乎过滤器包含正确的值,但就在我有这个 if 循环之后,在这种情况下,当联系人存在时 rs.EOF 为真...为什么?

If rs.EOF Then 'Or (rs.BOF = True) Then
    Debug.Print oLookFullName & " is not found."
End If

试试:

rs.Filter = "[titre] & ' ' & [Nom] = '" & oLookFullName & "' And [nomEntreprise] = '" & objContact.CompanyName & "'"

或:

rs.Filter = "[titre] = '" & Split(oLookFullName, " ")(0) & "' And [Nom] = '" & Split(oLookFullName, " ")(1) & "' And [nomEntreprise] = '" & objContact.CompanyName & "'"