How to anonimise a client name?

Yes it can be replicated using a simple function to look for spaces and taking the first letter after the space. Try searching for Split()
 
Hi DCrake,

Thanks for the info - does that function need to be used in vba ? I was hoping to use something that could go in to a select query (says undefined function when run)

Cant seem to find any google results either besides for people having trouble with the LEFT and INSTR functions as to middle names and hypenated names etc
 
You will have problems is all parts of the name are in one field. Or, do you have a First, Middle and Last name fields for all three parts? If not, you should.
 
I dont unfortunately have the client name split out to first/middle/last as I am importing off data that is given to me :/

What about selecting capital letters? is that just as long winded and inaccurate?
 
Thought I should help since ghudson and DCrake aren't online at the moment.

Are you doing this on query level or on a control on a form?
 
query level - the query is then used as a source for a pivot table and the names need to be anonimised
 
Here you go:
Code:
Public Function GetInitials(fullName As String) As String
    Dim arraySplit$()
    
    GetInitials = ""
    arraySplit = Split(fullName, " ")
    For Each element In arraySplit
        GetInitials = GetInitials & UCase(Left(element, 1)) & " "
    Next
    GetInitials = Trim(GetInitials)
End Function
Put that query in a MODULE and call it from the query like this:

GetInitials([FullName_Field])
 
Hi

sorry to resurrect this thread, but what if the surname is a Mc or Mac and you also want it to take the first initial after the Mc or Mac, in my case McEwen so that it would read R McE
 
The thing is there is more to it than just Mc or Mac. What about O'Brien and Radley-Smith?
 
The thing is there is more to it than just Mc or Mac. What about O'Brien and Radley-Smith?

:eek:

LMAO

cheers dude, think I might just tell them they're only getting 2 initials and they'll just have to like it :D
 
;)

It can be coded. Just tell me what those two cases should be and I'll tinker with it.
 
;)

It can be coded. Just tell me what those two cases should be and I'll tinker with it.

Cases? do you mean like examples?

Dont want to bother you unnecessarily, its like you said where do you draw the line with the likes of Mc, Mac, O'Toole and the youve got people with dutch names and such like Van Der Whatever.
 
Ah yes, I forgot the Dutch, French and German names. Yes, I agree you should just give them the first letter because as time goes on you will need to refine the code if a new case was determined.
 
Ah yes, I forgot the Dutch, French and German names. Yes, I agree you should just give them the first letter because as time goes on you will need to refine the code if a new case was determined.

sounds good to me!

thanks for responding anyway
 

Users who are viewing this thread

Back
Top Bottom