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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Like 1

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
How do we say Not Like? Can you use Not with Like

" Select * From MyTable WHERE CUST ID Not Like 'ABC*' "

I want to use this as the sql for a recordset object.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
You may try this:
"SELECT * FROM MyTable WHERE [CUST ID] Not Like 'ABC*'"
Or this:
"SELECT * FROM MyTable WHERE Not ([CUST ID] Like 'ABC*')"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
My apologies, It was actually in the VBA code behind a form. I had an If statement like so...

If MyField NOT LIKE "*abc" Then
'Do something
End If

This doesn't seem to work. What I ended up doing was...

If MyField LIKE "*abc" Then
'Do nothing
Else
'Do something
End If

Unless you have another alternative.

Thanks for the reply.


ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Have you tried this ?
If Not MyField LIKE "*abc" Then

BTW, "*abc" or "abc*" ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's earns you the grand prize! Thanks.

BTW, it didn't matter, I was just using random criteria to indicate any kind of wild card.

Thanks again.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top