[AccessD] Replace Function

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Tue Oct 21 09:14:42 CDT 2003


Gustav, I get an error message 'automation type not supported in Visual
Basic', but in any case speed is not #1 issue, I am much more concerned
that it doesn't work for words with apostraphe, and when I write
Replace(MyRecord(0),"'","''") I get error ByRef mismatch....

> Hi Oleg
>
> This is just about the slowest implementation available.
> If you need speed have a look here:
>
>   http://www.xbeat.net/vbspeed/c_Replace.htm
>
> Replace5 is a decent compromise between complexity and speed:
>
>   http://www.xbeat.net/vbspeed/c_Replace.htm#Replace05
>
> /gustav
>
>
>> thanks Jim. I alredy found it --
>
>> Public Function Replace(ByRef strText As String, strSearch As String,
>> strReplace As String) As String
>> Dim lngStrPos As Long
>
>> lngStrPos = InStr(1, strText, strSearch)
>>     Do While lngStrPos <> 0
>>         strText = Left$(strText, lngStrPos - 1) & strReplace &
>> Mid$(strText, lngStrPos + 1)
>>         lngStrPos = InStr(1, strText, strSearch)
>>     Loop
>>     Replace = strText
>> End Function
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail




More information about the AccessD mailing list