listbox rowsource & ampersands

  • Thread starter Thread starter Brian Bastl
  • Start date Start date
B

Brian Bastl

Hi all,

As a continuation of another thread, I'm trying to set the rowsource of a
listbox in the AfterUpdate event of txtSearch, but I'm not getting the
quotes and/ or ampersands right. I've seemingly tried every combination of
double and triple ampersands and quotation marks.

Me.lbResults.RowSource = "SELECT " & _
"tblClients.ClientID, [ClientFirst] & " " & [ClientName] AS Client " & _
"FROM tblClients " & _
"WHERE [ClientFirst] & " " & [ClientName] Like ""*" & Me.txtSearch & "*"""

Can someone straighten this out?

TIA,
Brian
 
Brian Bastl said:
Hi all,

As a continuation of another thread, I'm trying to set the rowsource
of a listbox in the AfterUpdate event of txtSearch, but I'm not
getting the quotes and/ or ampersands right. I've seemingly tried
every combination of double and triple ampersands and quotation marks.

Me.lbResults.RowSource = "SELECT " & _
"tblClients.ClientID, [ClientFirst] & " " & [ClientName] AS Client "
& _ "FROM tblClients " & _
"WHERE [ClientFirst] & " " & [ClientName] Like ""*" & Me.txtSearch &
"*"""

Can someone straighten this out?

Try this:

Me.lbResults.RowSource = _
"SELECT " & _
"ClientID, " & _
"ClientFirst & "" "" & ClientName AS Client " & _
"FROM tblClients " & _
"WHERE ClientFirst & "" "" & ClientName " & _
"Like ""*" & Me.txtSearch & "*"""
 
Back
Top