Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "IMPORT NEW DATA NOT ORIGINALY IN NATIVE FIELD"

IMPORT NEW DATA NOT ORIGINALY IN NATIVE FIELD

Help needed re comparing data

Current user: [none]
Register / Log In · Help

Posted By Post

Peter

6-Feb-2008 17:28

I have one cardbox database1 containing data ( Forename, Surname DOB etc ) I have new information containing similar data but with additional information in an excel file(Forename, Surname, DOB, Ref No, Policy No etc. I am trying to match the names with DOB in order to link the data and update the records.
I have created matching fields in the native field but when I import it does not import into the fields I had linked, I even created another cardbox database to try and resolve this issue

Help please

bert

6-Feb-2008 21:14

Peter,

ONLY with the latest build of Cardbox Client (4263) you can use added Excel macro.

This macro does:
--update the Cardbox record when there is one occurrence of a name
--add a record when there is zero records of the name
--let you decide which record is update when there are > then 1 name in the Cardbox db.

In this example (yes I know its quick and dirty):
--change the servername
--change database name
--column A is used for the name, is also selection term in Cardbox ; change it if relevant
--add lines for other columns - field place is here in Excel column 2.
    Example: cbr.fields("PL") = Cells(ActiveCell.Row, 2).Text
--it starts on the current Excel row, it ends when next lime is empty.

I tested it, this works.

Succes!
Bert Stortenbeker

The macro:

Sub adr_update()
dim rp
Set CBX = CreateObject("Cardbox.Application")
Set cbwin = CBX.Windows
Set cbfil = cbwin.OpenFile("cardbox://SERVERNAME/" & "DATABASENAME", 0, "master profile", "password")

Do
    cbfil.Select "NA", Cells(ActiveCell.Row, 1)
    If cbfil.RecordCount > 1 Then
         CBX.Visible = True
         CBX.MacroMethods.PlayText "Pause ""Set cursor on right record, then push ok"" "
         rp = cbfil.RecordPosition
         CBX.Visible = False
    End If

    If cbfil.RecordCount = 0 Then
         Set cbr = cbfil.Database.NewRecord
         cbr.fields("NA") = Cells(ActiveCell.Row, 1).Text
    Else
         If rp = 0 Then rp = 1
         Set cbr = cbfil.Records.Item(rp)
         cbr.Edit
    End If
    cbr.fields("PL") = Cells(ActiveCell.Row, 2).Text
    'field xx = excel column 3: cbr.fields("PL") = Cells(ActiveCell.Row, 3).Text etc etc
    cbr.Save
    If Cells(ActiveCell.Row + 1, 1) = "" Then
        Exit Do
    Else
        ActiveCell.Offset(1, 0).Select
    End If
    cbfil.SelectionLevel = 0
    rp = 0
Loop

End

End Sub

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home