SQL - Like Command

  • Thread starter Thread starter Doug Van
  • Start date Start date
D

Doug Van

I am trying to get a list box to populate that meets three critera.

My code works for the first two conditions, but not the third, the "like"
portion.

lstResults.RowSource = "SELECT code, description from NCCI where 1stInsured
= NCCI.Insured and cmbState = NCCI.State and NCCI.description like text10"

Any ideas?

Thanks in advance.
Doug
 
lstResults.RowSource = "SELECT code, description from NCCI
where 1stInsured = NCCI.Insured and cmbState = NCCI.State
and NCCI.description like '*" & text10 & "*'"


Is cmbState a combo box on your form? Also, is 1stInsured
the same?

If so, I would rewrite it to be:

lstResults.RowSource = "SELECT code, description from NCCI
where NCCI.Insured='" & 1stInsured & "' and
NCCI.State='" & cmbState & "' and NCCI.description
like '*" & text10 & "*'"

Chris
 
Thanks Chris.


Chris said:
lstResults.RowSource = "SELECT code, description from NCCI
where 1stInsured = NCCI.Insured and cmbState = NCCI.State
and NCCI.description like '*" & text10 & "*'"


Is cmbState a combo box on your form? Also, is 1stInsured
the same?

If so, I would rewrite it to be:

lstResults.RowSource = "SELECT code, description from NCCI
where NCCI.Insured='" & 1stInsured & "' and
NCCI.State='" & cmbState & "' and NCCI.description
like '*" & text10 & "*'"

Chris
 
Back
Top