Thanks Russ,
Great improvement indeed, I understand what you did. The part with the surname 
having a space was also taken care of.
Thanks again.
Lennox.

Russ Jones <[EMAIL PROTECTED]> wrote: Congratulations, Lennox.
It's always fun to get something working.

And input editing can be complicated.
I am not sure what the source of your data will be, but I'd like to  
suggest a bit of further improvement, because the code you posted  
will get confused by
- leading spaces,
- extra spaces between first and last names,
- last names that contain spaces, such as "van Deusen"
and, if you come across a patient with just one name, such as  
"Madonna", the code will crash.

So, Ill respectfully submit:

   Dim TheWholeName as string
   Dim PatientNameSplitted(1) as String  // assume first name, last name

   TheWholeName = Ltrim(PatientName.Text) // remove leading spaces

   PatientNameSplitted(0) = NthField(TheWholeName," ",1) // first  
name only
   PatientNameSplitted(1) = trim(right(TheWholeName,len(TheWholeName)- 
len(PatientNameSplitted(0)))) // all the rest, ignoring leading and  
trailing spaces

   PatientNameSplit(0).text = PatientNameSplitted(0) 'EditField  
PatientNameSplit(0) populated now
   PatientNameSplit(1).text = PatientNameSplitted(1)  'EditField  
PatientNameSplit(0) populated now

As I said, input editing can get complicated.
For instance, the code I am posting does not properly handle titles  
(Dr., Mr., Mrs., etc.) nor does it split off honorifics (Ph.D., etc.)

I hope you find this encouraging.

Russ

On Aug 27, 2006, at 10:06 PM, Lennox Jacob wrote:

> Thanks Russ,
> Did as you said and got this
>
>   Dim TheWholeName as string
>   Dim PatientNameSplitted() as String  ' Renamed
>
>   TheWholeName = PatientName.Text
>
>   PatientNameSplitted() = Split(TheWholeName, " ")  'Splitting took  
> place
>
>
>   PatientNameSplit(0).text = PatientNameSplitted(0) 'EditField  
> PatientNameSplit(0) populated now
>   PatientNameSplit(1).text = PatientNameSplitted(1)  'EditField  
> PatientNameSplit(0) populated now
>
> and it works well.
>
> Thanks again.
>
> Lennox.

_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:



                
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to