WHERE LIKE syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write a SQL string using the LIKE operator to find all the
records starting with a letter entered in text box txtSortModelsPrefix.

I am trying this but it does not work:
"WHERE (((tblModelNums.ModelNum) Like (txtSortModelsPrefix'*'))) "


This works but offcourse it’s not taking ‘M’ from the text box
"WHERE (((tblModelNums.ModelNum) Like 'M*')) "


Thanks for any help,
Seth
 
Try a full reference to the text box, with the wildcard concatenated:

"WHERE tblModelNums.ModelNum Like Forms!Form1!txtSortModelsPrefix & '*' "
 
I am trying to write a SQL string using the LIKE operator to find all the
records starting with a letter entered in text box txtSortModelsPrefix.

I am trying this but it does not work:
"WHERE (((tblModelNums.ModelNum) Like (txtSortModelsPrefix'*'))) "


This works but offcourse it’s not taking ‘M’ from the text box
"WHERE (((tblModelNums.ModelNum) Like 'M*')) "


Thanks for any help,
Seth

Try

WHERE (((tblModelNums.ModelNum) Like
[Forms]![YourFormNameHere]![txtSortModelsPrefix] & '*'


John W. Vinson[MVP]
 
Back
Top