[AccessD] Break Name

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Wed Jan 21 12:08:33 CST 2004


Andy ! - you are a genius.
(well I knew that for a while now)
:))
thanks

> Oleg, just do it your DAO loop, so
>
> With rs
>   Do Until .EOF
>     strLine = ![Employee Name]
>     strLine = Proper(strLine)
>
>     a = InStr(strLine, ",")
>     FName = Mid(strLine, a + 2)
>     LName = Left(strLine, a - 1)
>     .Edit
>     !Lastname=Lname
>     !FirstName=Fname
>     .Update
>     .MoveNext
>   Loop
> End With
>
> Andy Lacey
> http://www.minstersystems.co.uk
>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
>> Oleg_123 at xuppa.com
>> Sent: 21 January 2004 16:35
>> To: accessd at databaseadvisors.com
>> Subject: [AccessD] Break Name
>>
>>
>> Hey Group
>> I did a finction that separates names into first and last,and
>> makes propercase - ex. Name: "MCDONALD, REYNA" becomes
>> FirstName: "Reyna" LastName "McDonald" How can Insert the 2
>> new fields into the same table ? I tried Update...
>>
>>
>>
>> Public Function BreakName()
>>
>>
>> 'Separate The Name field to Firs and LastName and ProperCase
>> it 'Uses MDL-Proper Module
>>
>>
>> MsgBox ("hey")
>> Dim db As DAO.Database
>> Dim rs As DAO.Recordset
>> Set db = CurrentDb
>>
>> Dim strLine As String
>> Dim strSQL1 As String
>> Dim strSQL2 As String
>> Dim FName As String
>> Dim LName As String
>> Dim a As Integer
>>
>>
>> strSQL1 = "Select * From [emp table1]"
>> Set rs = db.OpenRecordset(strSQL1)
>>
>>
>>   Do Until rs.EOF
>> strLine = rs("Employee Name")
>> '
>> strLine = Proper(strLine)
>> a = InStr(strLine, ",")
>> FName = Mid(strLine, a + 2)
>> LName = Left(strLine, a - 1)
>>
>> 'rs(0) = strLine
>>
>>
>>   strSQL2 = "Update [Emp Table1] Set (LastName, FirstName) =
>> Values(" & "'" & FindAndReplace(CStr(LName), Chr(39), Chr(39)
>> + Chr(39)) & "','" & FindAndReplace(CStr(FName), Chr(39),
>> Chr(39) + Chr(39)) & "')" Debug.Print strSQL2
>>
>>     CurrentDb.Execute (strSQL2)
>>     rs.MoveNext
>>   Loop
>>
>>    MsgBox ("end")
>>
>> End Function
>>
>>
>>
>> -----------------------------------------
>> Get Breaking News from CNN, ABC, NBC, CBS Now.
>> http://www.xuppa.com/news/?link=webmail
>>
>>
>>
>> _______________________________________________
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/a> ccessd
>> Website:
>> http://www.databaseadvisors.com
>>
>>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com







-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail




More information about the AccessD mailing list