This will work if each name part can be passed as a separate argument.
If first, last and middle are all in the same field, with middle being optional, then more code required.
What happens if middle is just a single initial? Code below requires all names to be longer than 2 characters.
Code:
Public Function fcnAnon(arg As String) As String
Dim L As Integer
Dim i As Integer
Dim rslt As String
L = Len(arg)
If L > 2 Then
rslt = Left(arg, 2)
For i = 3 To L
rslt = rslt & "*"
Next i
End If
fcnAnon = rslt
End Function