Using LIKE operator in an SQL statement not working. Please help.

ToddMac

New member
Local time
Today, 14:18
Joined
Nov 2, 2019
Messages
4
Not sure what I am doing wrong and I am sure that it is a formatting error.


This works:
Code:
!lstSel.RowSource = "Select ag_auto, PID, AgreeNum, Contractor, LandOwner, Type FROM qryAgreeSel WHERE ag_del = 0 AND PID Like '*224*' Order by PID"

This doesn't:
Code:
!lstSel.RowSource = "Select ag_auto, PID, AgreeNum, Contractor, LandOwner, Type FROM qryAgreeSel WHERE ag_del = 0 AND PID Like '* & !txtPre & *' Order by PID"
Any help tweaking this is appreciated.



Thank you.
 
Hi Todd. Welcome to AWF!


Try it this way:
Code:
...WHERE ag_del = 0 AND PID Like '*[COLOR=red]"[/COLOR] & !txtPre & [COLOR=red]"[/COLOR]*' Order by PID"
 
Hi Todd. Welcome to AWF!


Try it this way:
Code:
...WHERE ag_del = 0 AND PID Like '*[COLOR=red]"[/COLOR] & !txtPre & [COLOR=red]"[/COLOR]*' Order by PID"


Sweet. I missed that.



Works perfectly.



Glad to be here!
 
Hi. Glad to hear you got it to work. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom