Hi all,
I have a textbox called SAL (short for Salutation) that copies the value of another textbox called Name, but displays it so that all middle initials or names are gone leaving title and lastname.
e.g.
Mr T Brown becomes Mr Brown
Mrs J L Andrews Becomes Mrs Andrews
Mr John Smith becomes Mr Smith.
This works but i have it so that the texbox SAL is bound but is it possible to keep it unbound. This is because i can get errors, for instance if the name entered in the Name textbox is one string there is an error in the SAL textbox; e.g. Occupier. Also something has to be entered into the textbox name to get something displayed in Salutation is it posssible to enter a seperate value for sal or Also because the Name textbox can be left blank sometimes allow an entry in SAL even if Name is not entered in Name textbox.
For instance i was thinking having some code on dbl click of the textbox, so its optional whether to copy and manipulate the value ot textbox name.
This is the value in the control source of my SAL textbox
Also I am using Access 97 which does not have MyInStrReverse function so i also got this module:
Any help very much appreciated, thanks in advance,
M-.
I have a textbox called SAL (short for Salutation) that copies the value of another textbox called Name, but displays it so that all middle initials or names are gone leaving title and lastname.
e.g.
Mr T Brown becomes Mr Brown
Mrs J L Andrews Becomes Mrs Andrews
Mr John Smith becomes Mr Smith.
This works but i have it so that the texbox SAL is bound but is it possible to keep it unbound. This is because i can get errors, for instance if the name entered in the Name textbox is one string there is an error in the SAL textbox; e.g. Occupier. Also something has to be entered into the textbox name to get something displayed in Salutation is it posssible to enter a seperate value for sal or Also because the Name textbox can be left blank sometimes allow an entry in SAL even if Name is not entered in Name textbox.
For instance i was thinking having some code on dbl click of the textbox, so its optional whether to copy and manipulate the value ot textbox name.
This is the value in the control source of my SAL textbox
Code:
=IIf(Not IsNull([Name_Input]),Left([Name_Input],InStr(1,[Name_Input]," ")-1) & " " & Right([Name_Input],Len([Name_Input])-MyInStrReverse([Name_Input]," ")),"")
Also I am using Access 97 which does not have MyInStrReverse function so i also got this module:
Code:
Function MyInStrReverse(Instring As String, Searchstring As String)
Dim i As Integer
Dim Char As String
i = Len(Trim(Instring))
Do While Char <> Searchstring
Char = Mid(Trim(Instring), i, 1)
i = i - 1
Loop
MyInStrReverse = i + 1
End Function
Any help very much appreciated, thanks in advance,
M-.