I found the following function (on this wonderful site)to work, But
Numbers like 123.00 and 123.50 convert To 123 and 123 5 with no zeros, and need to be like 123 00 and 123 50. as long as there are 2 numbers like 123.11 it works fine. Is there any way to force the zeros to apear? I cannot make the source field text because I have computations prior to converting the number. Any help would be greatly appreciated.
Mary
Public Function ReplaceString(ByVal SourceString As String, ByVal OriginalString As String, ByVal NewString As String) As String
'Recursive function ReplaceString searches Source string and replaces ALL OCCURRENCES of OriginalString with NewString.
'If a value for NewString is ommitted (or IsEmpty), then all occurrences of OriginalString are removed from the SourceString!
Dim Position As Integer
If SourceString = "" Or IsNull(SourceString) Then
ReplaceString = SourceString
Else
Position = InStr(1, SourceString, OriginalString)
If Position > 0 Then
ReplaceString = (Mid$(SourceString, 1, Position - 1) & NewString & ReplaceString(Mid(SourceString, Position + Len(OriginalString)), OriginalString, NewString))
Else
ReplaceString = SourceString
End If
End If
Numbers like 123.00 and 123.50 convert To 123 and 123 5 with no zeros, and need to be like 123 00 and 123 50. as long as there are 2 numbers like 123.11 it works fine. Is there any way to force the zeros to apear? I cannot make the source field text because I have computations prior to converting the number. Any help would be greatly appreciated.
Mary
Public Function ReplaceString(ByVal SourceString As String, ByVal OriginalString As String, ByVal NewString As String) As String
'Recursive function ReplaceString searches Source string and replaces ALL OCCURRENCES of OriginalString with NewString.
'If a value for NewString is ommitted (or IsEmpty), then all occurrences of OriginalString are removed from the SourceString!
Dim Position As Integer
If SourceString = "" Or IsNull(SourceString) Then
ReplaceString = SourceString
Else
Position = InStr(1, SourceString, OriginalString)
If Position > 0 Then
ReplaceString = (Mid$(SourceString, 1, Position - 1) & NewString & ReplaceString(Mid(SourceString, Position + Len(OriginalString)), OriginalString, NewString))
Else
ReplaceString = SourceString
End If
End If