Operator missing error
I've set up a query to filter the results of the second Combobox. this works fine it I write the code by hand. When I use the query with a variable, it does not work anymore. the problem is probably the where clause, so I focus on that one:
"WHERE tblCompany.CompName Like '" & tempCompName & "' And tblContact.ContAccounting = True " & _
I do see the part of the company name I'm looking for
the full SQL is below.
CompInvoiContID.RowSource = "SELECT tblContact.ContactID, IIf(Trim([ContFirstName])="",[ContLastName],[ContFirstName] & "" "" & [ContLastName]) AS ContactDetails, tblCompany.CompStreet, " & _
"tblCompany.CompCity, tblCountry_1.CountryName, tblContact.CompID, tblContact.ContCountryID, tblContact.ContMobPhone, tblContact.ContPhone, tblContact.ContEmail, tblContact.ContFunction, " & _
"tblContact.ContDepartment, tblCountry.CountryName, tblCompany.CompName, tblCompany.CompName, tblContact.ContAccounting " & _
"FROM tblCountry INNER JOIN ((tblContact INNER JOIN tblCompany ON tblContact.CompID = tblCompany.CompID) INNER JOIN tblCountry AS tblCountry_1 ON tblCompany.CompCountryID = tblCountry_1.CountryID) " & _
"ON tblCountry.CountryID = tblContact.ContCountryID " & _
"WHERE tblCompany.CompName Like '" & tempCompName & "' And tblContact.ContAccounting = True " & _
"ORDER BY IIf(Trim([ContFirstName])="",[ContLastName],[ContFirstName] & "" "" & [ContLastName]);"
I've set up a query to filter the results of the second Combobox. this works fine it I write the code by hand. When I use the query with a variable, it does not work anymore. the problem is probably the where clause, so I focus on that one:
"WHERE tblCompany.CompName Like '" & tempCompName & "' And tblContact.ContAccounting = True " & _
I do see the part of the company name I'm looking for
the full SQL is below.
CompInvoiContID.RowSource = "SELECT tblContact.ContactID, IIf(Trim([ContFirstName])="",[ContLastName],[ContFirstName] & "" "" & [ContLastName]) AS ContactDetails, tblCompany.CompStreet, " & _
"tblCompany.CompCity, tblCountry_1.CountryName, tblContact.CompID, tblContact.ContCountryID, tblContact.ContMobPhone, tblContact.ContPhone, tblContact.ContEmail, tblContact.ContFunction, " & _
"tblContact.ContDepartment, tblCountry.CountryName, tblCompany.CompName, tblCompany.CompName, tblContact.ContAccounting " & _
"FROM tblCountry INNER JOIN ((tblContact INNER JOIN tblCompany ON tblContact.CompID = tblCompany.CompID) INNER JOIN tblCountry AS tblCountry_1 ON tblCompany.CompCountryID = tblCountry_1.CountryID) " & _
"ON tblCountry.CountryID = tblContact.ContCountryID " & _
"WHERE tblCompany.CompName Like '" & tempCompName & "' And tblContact.ContAccounting = True " & _
"ORDER BY IIf(Trim([ContFirstName])="",[ContLastName],[ContFirstName] & "" "" & [ContLastName]);"