![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
#4
| |||
| |||
|
|
No. I just want to search "A B". but it must be return all values that ignoring space at the middle. |
#5
| |||
| |||
|
|
On 5 Apr 2005 23:55:56 -0700, "Dishan Fernando" <dishan (AT) gmail (DOT) com> wrote: No. I just want to search "A B". but it must be return all values that ignoring space at the middle. Any way you might do it will be inefficient. Essentially, you have to write a custom function that collapses strings of multiple spaces, and call it from within the query, or open a recordset, loop through it, and call the compare function for each row. Calling the function from within the query is simpler, but looping through the recordset is more robust, and probably at least as fast. Here's one way you might write the function (not tested)... Public Function CollapseSpaces(Value As String) As String Dim strResult As String strResult = Trim$(Value) Do While Instr(strResult, " ") > 0 strResult = Replace(strResult, " ", " ") Loop CollapseSpaces = strResult End Function |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
select * FROM Table1 WHERE REPLACE(COL,' ','') LIKE '%A B%' AND Col NOT LIKE '%AB%' |
#8
| |||
| |||
|
|
Hi, I want to search Strings Like this. Say Column containing ... "A B" "A B" "A B" "A B" "A B" How can I search "A B" with ignoring spaces. Result must return all the records. Thank you. Dishan |
#9
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |