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?
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
For rec = 1 to Records.Count
key = trim(fields("keyfield"))
xt = fields("**")
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
Fields("**") = xt
key = ""
xt = ""