How to use equal to instead of like (1 Viewer)

boknoval

Registered User.
Local time
Today, 09:05
Joined
Mar 9, 2012
Messages
25
I have this form search.
Instead of using the LIKE function, I would like it to be 'equal to'.

here's that line of my code:
Code:
If Me.txtPropertyStatus > "" Then
 varWhere = varWhere & "[PRO_STATUS] LIKE """ & Me.txtPropertyStatus & "*"" AND "

how can i convert this line to 'equal to'? thanks!
 

pr2-eugin

Super Moderator
Local time
Today, 02:05
Joined
Nov 30, 2011
Messages
8,494
Hello Bok, Welcome to AWF.. :)

Well if you are using a Wildcard Character in your Criteria you have to use LIKE operator.. No other option..

Say for example if you have Property status as 'Sold' and 'Sold on Lease'.. When you use Like both the status is returned as result.. But if you use equals (=) then it will look for a String that has "Sold*"..
 
Last edited:

boknoval

Registered User.
Local time
Today, 09:05
Joined
Mar 9, 2012
Messages
25
Hi pr2-eugin, thanks for your reply. The reason why I don't want to use the LIKE operator is that based on the example you have given, when I input sold, I wanted to filter out only those properties with property status as sold and would not include the sold on lease status. Is it possible?
 

pr2-eugin

Super Moderator
Local time
Today, 02:05
Joined
Nov 30, 2011
Messages
8,494
Yes, if you do not wish to use the Wild card operator by all means you can use the =.. Remove the * and use =..

BTW, I am looking at your other thread on Search.. I will update some of my comments on that..
 

boknoval

Registered User.
Local time
Today, 09:05
Joined
Mar 9, 2012
Messages
25
How can I do that exactly pr2-eugin? haha! i'm really sorry if I am asking these dumb questions. I'm really not a programmer and I have just adapted this search form code (found it also from this forum).
 

pr2-eugin

Super Moderator
Local time
Today, 02:05
Joined
Nov 30, 2011
Messages
8,494
Just give me a few minutes while I do some modification to your code.. Do you want equals only on Property Status or all other Fields?
 

boknoval

Registered User.
Local time
Today, 09:05
Joined
Mar 9, 2012
Messages
25
I want the equals only on the Property Status. Yay! thank you very muc pr2-eugin. I will wait for that modification. You're a lifesaver! :)
 

Users who are viewing this thread

Top Bottom