Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "Recovering extra text from an old database"

Recovering extra text from an old database

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

Posted By Post

Ritchie

7-Jun-2010 20:42

Many years ago, I somehow lost all my extra text converting an old database into a new database. The field-definitions are the same but the newly build database has one extra (graphic) field. Into this field I recently introduced single photo's in a some 1000 records - and still have another thousand to do.
Also, the new database has a few more records than the old one.
Question: how can I copy automated the extra text from the old database into the new one -off course they have to be copied into the same/correct record. One field is a number field looking like this: xx.xx.xx where x is any number 0-9. So both databases have this field and I want extra text from the old database written into the same record - where the new database has a few records that are not present in the old database. Suggestions how to do this?
Ritchie

Iuliana

7-Jun-2010 21:46

The way to proceed depends on the respective versions of Cardbox the "old" and "new" databases were created. Could you give the particulars?

bert

8-Jun-2010 08:31

A pity that Cardbox misses an "update" function.
One of my future wishes for Cardbox. (Cardboss it's on my list!)

However, there is a way to get what you want - you defined a (unique) key field!

You need a macro to get what you want. Read below and:
- Change "keyfield" to the field name of your key field name
- Change "newdb" to the window name of your new db.
Start the macro (ONLY!!) when as well as your olddb as your newdb is opened and olddb is on your screen (the active database).

This is a simple macro for it:

olddb = caption
SelectionLevel = 0
FirstRecord

For rec = 1 to Records.Count
   key = trim(fields("keyfield"))
   xt = fields("**")
   Activate "newdb"
   SelectionLevel = 0
   SelectData "keyfield",key,cbxDataMatchPunctuation 'I use data search because I cannot know if the key always works with index search - n.n.n. = a date format!
   if Records.Count <> 1 then Msgbox "There is an error: more or none records in NEWDB exists with key " & key & ". Macro wilt halt now.", vbExclamation, Database : halt
   EditRecord
   Fields("**") = xt
   SaveRecord
   key = ""
   xt = ""
   Activate olddb
   NextRecord
Next

Success
Bert

Quick Reply

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

 
© 2010 Cardbox Software Limited   Home