Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Re: Combining Field Data

Discussion in 'Information Technology' started by Stacy, Oct 29, 2005.

  1. Stacy

    Stacy
    Expand Collapse
    Guest

    Ok, so I have most of my code sketched out, but I am still having
    issues....
    My Code (below) adds the records to my new table fine, however, only
    the first name on my new table is looked at for potential duplicates,
    and I need it to scan the whole table for duplicate names, not just the
    first one. Any ideas?

    Plus, how do I get around the initial new table being empty. I keep
    getting a "no current record" error.

    Any help is appreciated.
    I am not great with VB code, just a novice trying to get my code to
    create miracles.
    Have a good day.
    Stacy


    Dim Str As String
    Dim rst As DAO.Recordset
    Dim rst2 As DAO.Recordset
    Dim db As DAO.Database
    Set db = CurrentDb
    Set rst = db.OpenRecordset("SELECT * FROM tblMasterPeople order by
    full_name")
    Set rst2 = db.OpenRecordset("SELECT * FROM tblFinCENCustomers order by
    full_name")
    rst.MoveFirst

    Do Until rst.EOF
    If rst!full_name = rst2!full_name Then
    With rst2
    .Edit
    !newdob = !dob & " ; " & rst!dob
    .Update
    End With
    rst.MoveNext
    Else
    With rst2
    .AddNew
    !tracking_number = rst!tracking_number
    !Entity = rst!Entity
    !last_name = rst!last_name
    !first_name = rst!first_name
    !middle_name = rst!middle_name
    !suffix = rst!suffix
    !full_name = rst!full_name
    !dob = rst!dob
    .Update
    End With
    rst.MoveNext
    End If
    Loop

    rst.Close
    rst2.Close
    MsgBox "Complete"
     
  2. Loading...


Share This Page