Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

like and not like

Status
Not open for further replies.

vlad123

Programmer
Jun 22, 2005
37
DE
Hi! I have 2 lists with urls. I want to delete all records from a table (link) if link.url like list1.column(0)and not like list2.column(0).
so, to delete all that are in the first list but not in the second list.
I have this:
strsql = "delete * from dbo_link where dbo_link.url like '*" & CStr(Me.lstExclude.Column(0)) & "*'and not like '*" & CStr(Me.lstInclude.Column(0)) & "*';"
DoCmd.RunSQL strsql
Error: syntax error. missing operator in query expression.

the value from Watches (this is the case when the link is in both lists) is this:

"delete * from dbo_link where dbo_link.url like '* and not like '*
do you have any sugestions?!
 
strsql = "DELETE FROM dbo_link WHERE dbo_link.url LIKE '*" & Me!lstExclude.Column(0) & "*' AND dbo_link.url NOT LIKE '*" & Me!lstInclude.Column(0) & "*'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you very much! I am a beginner so sometimes I guess I need "glasses" for finding the solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top