Hi All,
I have a small function that evaluates a string looking for an apostrophe, I call this function from within a do while loop on a recordset that is inserting into a table. How do I get the result of my function ( string without "'") back?
here is my code:
I want the result of this function to insert into my table...any suggestions?
I have a small function that evaluates a string looking for an apostrophe, I call this function from within a do while loop on a recordset that is inserting into a table. How do I get the result of my function ( string without "'") back?
here is my code:
Code:
[b][blue]Do while loop[/blue][/b]
Public Function CreateOutput(pstrSource As String, OutputType As Integer, Optional intPage As Integer)
Dim rstOutput As New ADODB.Recordset
Dim strSQL As String
Set cnnICInquiry = CurrentProject.Connection
Set rstOutput = New ADODB.Recordset
rstOutput.Open StrSQLUnion, cnnICInquiry, adOpenKeyset, adLockOptimistic
If rstOutput.EOF = True Then
Else
rstOutput.MoveFirst
Do While rstOutput.EOF = False
Call ReplaceEmbedded("'", " ", rstOutput!custname)
Code:
[b][red]The function [/red][/b]
Public Function ReplaceEmbedded(CharsToRemove As String, CharsToReplace As String, FromString As String)
'''------------------------------------------------
''' Replaces one character with another in a string
'''------------------------------------------------
Dim i As Integer, s As String
For i = 1 To Len(FromString)
If InStr(CharsToRemove, Mid$(FromString, i, 1)) = 0 Then
s = s & Mid$(FromString, i, 1)
Else
s = s & CharsToReplace
End If
Next i
ReplaceEmbedded = s
End Function