Trim name problem (1 Viewer)

krazykasper

Registered User.
Local time
Today, 05:48
Joined
Feb 6, 2007
Messages
35
The Order Rep Names in my ODBC table appear as:

Lastname, Firstname OR Lastname, Mi. Firstname

I need to change them in my Crystal report to appear as:
Firstname Mi. Lastname

When I do the same thing in a VBA report my code is:
Function ParseFirstComp(OrderRepName) As String
ParseFirstComp = "" 'set the default return value
If Not IsNull(OrderRepName) Then
Dim LPosition As Integer
'Find postion of space
LPosition = InStr(OrderRepName, " ")
'Return the portion of the string before the space
If LPosition > 0 Then
ParseFirstComp = Left(OrderRepName, LPosition - 2)
End If
End If
End Function
Function ParseSecondComp(OrderRepName) As String
ParseSecondComp = "" 'set the default return value
If Not IsNull(OrderRepName) Then
Dim LPosition As Integer
'Find postion of space
LPosition = InStr(OrderRepName, " ")
'Return the portion of the string after the space
If LPosition > 0 Then
ParseSecondComp = Mid(OrderRepName, LPosition + 1)
End If
End If
End Function
And then in my query:
Trim ({OptimizeIt.OrderRepName}) ([Expr2] & " " & [Expr1])

Can someone provide me the code so I can do the same in my Crystal Report? I expect I would put the code in a formula.

Thanks,

Krazy (Bill) Kasper
 

Kempes

Registered User.
Local time
Today, 11:48
Joined
Oct 7, 2004
Messages
327
Are they 2 seperate fields? ie, firstname and lastname?

if so....

firstname & " " & Lastname

(replace the firstname and lastname with your correct field name though).
 

Users who are viewing this thread

Top Bottom