A couple weeks ago I posted a question similar (regarding deleting
records) and received an answer that worked great.  What I
am trying to do is cycle through records and duplicate them, changing a
date field.

My record looks like this

//...
UInt32 Date
Char [10] Stuff
//...

For example, I want to cycle through record indexed 41-57, changing the
date value and adding the new records to the database.
What happens in dupAddToDatabase, is that it uses a compare function to
find the insertion point in the database to add the
record to.  What happens when this function gets run, the first record
that matched the criteria is copied over and over again
instead of "looping" through the records.

Any ideas?

Thanks,
Ed Ross

=========================

number = DmNumRecordsInCategory (gDB, dmAllCategories);

for (i = 0; i < number; i++) {
    recH = DmQueryRecord((gDB), (i));

    if (recH) {
        rec = MemHandleLock(recH);

        if (rec->Date == g_YESTERDAY) {
            record.Date = g_TODAY;
            StrCopy(record.Stuff, rec->Stuff);

            error = dupAddToDatabase(&record, NULL, NULL, NULL);
         }
    }
}


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to