Relace Function with case sensitive

deen

Registered User.
Local time
Today, 21:15
Joined
Oct 12, 2012
Messages
10
The Replace Function did not return the result with the case sensitive.
Example if I set the Replace Function like :

Replace(me.text1,"hotel","motel")

the result will be = "motel"

even if the word inside the me.text1 is "Hotel".

please help me.
 
Try,

First strComp() two strings and return binary result and if statement for matching results to use replace function. Does this sound doable for you.
 
Sorry. I don't get it.
How would I use this function with the Replace function.

Thanks.
 
Re: Relace Function with case sensitiveoo

If you just want to replace data in more than one record ie all records currently loaded, would not the Find and Replace Dialog box do the trick?. In your scenario highlight Text1 then press Ctl + H. enter hotel in the [find what ]box and Motel in the [replace with box]. in the [look in] box drop down, click text1. which will be there if you have highliglhted it ,You then have the option to replace the word Motel in all or just the current record .
If you have already considered this, sorry to have wasted your time.
 
Post little bit further your requirement and some sample result.
 
Hi

try

replace(me.text1,"hotel","motel",,,vbBinaryCompare)
 
What you now need in this. It is doing what you wanted in your first post.
 
Actually there are more than one "hotel" words in my textbox. What I need is to make every word replace with same case. Example :

"hotel" to "motel"
"Hotel" to "Motel"
"HOTEL" to "MOTEL"

I try the "replace(me.text1,"hotel","motel",,,vbBinaryCompare )" but not working.

I don't know how to use "strConv" or "strComp" with the Replace function and I hope somebody will show me how to do it.
 
Hi

Try

lResult = Replace(Me.Text1, "hotel", "motel", , , vbBinaryCompare)
lResult = Replace(lResult, "Hotel", "Motel", , , vbBinaryCompare)
lResult = Replace(lResult, "HOTEL", "MOTEL", , , vbBinaryCompare)
Me.Text1 = lResult
 
This code working good :

lResult = Replace(Me.Text1, "hotel", "motel", , , vbBinaryCompare)
lResult = Replace(lResult, "Hotel", "Motel", , , vbBinaryCompare)
lResult = Replace(lResult, "HOTEL", "MOTEL", , , vbBinaryCompare)
Me.Text1 = lResult

Thanks Ari for your help.
 

Users who are viewing this thread

Back
Top Bottom