Hi, As what Paul Gibson said, I suggest:
TimSecondsToDateTime (TimGetSeconds (), &dateTime); todayInt = ( ((Int32) dateTime.year-1904) << 16) + ( ((Int32) dateTime.month) << 8) + ((Int32) dateTime.day); // do you have the right number of records in the DB? if not sure, then // umRecordsNeu = DmNumRecords(gVeranstaltungNeuDB); // start from the last record because after we delete // a record, the record num will be changed // I use DmRemoveRecord(), so I am not sure if // you use DmDeleteRecord() the record num get changed or not for (recordNeuNum = umRecordsNeu - 1; recordNeuNum >= 0; recordNeuNum --) { // why do you need to seek the record when you look for record in "All" category //DmSeekRecordInCategory(gVeranstaltungNeuDB, //&recordNeuIndex, 0, dmSeekForward, dmAllCategories); //recordH = DmQueryRecord (gVeranstaltungNeuDB, recordNeuIndex); recordH = DmGetRecord(gVeranstaltungNeuDB, recordNeuNum); if (!recordH) { FrmCustomAlert(MyAlert, "Problem beim Auslesen der neuen DB!","", ""); err = DmGetLastErr(); break; } else { pointer_auf_neue_v = (Veranstaltung_neu *)MemHandleLock(recordH); if (!pointer_auf_neue_v) { // proper error message ... :-) FrmCustomAlert(MyAlert, "Problem with DB!","", ""); err = DmGetLastErr(); break; } else { //if not, then continue ... // do you need this? //neueVeranstaltung = *pointer_auf_neue_v; // ### Position 1 for ####### MemHandleUnlock(recordH); // can't unlock here because if you unlock, you may not // have the right value in // pointer_auf_neue_v // delete all old records. dateInt = ( ((Int32) pointer_auf_neue_v->datum_jahr) << 16) + ( ((Int32) pointer_auf_neue_v->datum_monat) << 8) + ((Int32) pointer_auf_neue_v->datum_tag); if (todayInt > dateInt) { MemHandleUnlock(recordH); err = DmDeleteRecord(gVeranstaltungNeuDB, recordNeuNum); deletedOldRecordsNum ++; } else { // so now, every record is in the future.. // do some stuff with this record MemHandleUnlock(recordH); } } } } // next in loop //If you don't need to sort other field of the records, //you can sort by date, then you don't have to go thru all the records... Hope that helps. tnn __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/