I've created a report, and I have a limited amount of space to work with. I have a field called salesperson, in which the salesperson enters both their first and last name. Is it possible, in the report to just extract the salespersons initials?
Function GetInitials(txtName As Variant)
Dim Temp As String
Dim count As Integer
Temp = txtName
count = Len(txtName)
GetInitials = left(txtName, 1)
Do While count <> 0
If left(Temp, 1) = Chr(32) Or left(Temp, 1) = Chr(45) Then
GetInitials = GetInitials & Mid(Temp, 2, 1)
End If
count = count - 1
Temp = right(Temp, count)
Loop
End Function
Where have you put the =GetInitials([yourfield]) statement?
I should go in the controlsource of the textbox where you want to show the initials.
Also make sure that the function is in a module, not in the code behind the report.
Is the function in a separate module or in the code behind the original report. You must create a new module and paste the code there. This makes the function available to the whole of the Db, not just the report where it is likely currently situated.