I'm guessing you handtyped this is rather than cut and paste from code,
but...
1. Is the DmNumRecords() call supposed to be referring to DB or
IssueDB? (which you use in the DmQueryRecord() call
2. The (recP->completed = true) causing an assignment was already
mentioned by John, but worth mentioning again.
> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 27, 2000 8:20 PM
> To: Palm Developer Forum
> Subject: Purging records problem
>
>
> Can anyone help find the error in the following code?? I've been
> staring at it for days and can't work out what the problem is. I've
> looked at the purge code in the ToDo app source code and can't see
> anything different.
>
> The problem comes with the MemHandleLock...but I can't work out why.
>
> TIA,
>
> John.
>
> void PurgeRecords (void)
> {
> Word result;
> UInt i;
> UInt maxrecords;
> VoidHand recH = NULL;
> RecordTypePtr recP = NULL;
> TablePtr table;
> FormPtr form;
>
>
> result = FrmAlert(ConfirmPurge);
> if (result == 0) //Change back to 0 to make work
> {
> //Purge
> form = FrmGetActiveForm();
> FrmSetFocus(form, noFocus);
>
> maxrecords = DmNumRecords (DB);
> if (! maxrecords) return;
>
> for (i = 0; i < maxrecords; i++)
> {
> recH = DmQueryRecord(IssueDB, i);
> if (recH == 0) continue;
> recP = (RecordTypePtr) MemHandleLock (recH);
> if (recP->completed = true)
> {
> MemHandleUnlock(recH);
> DmRemoveRecord(DB, i);
> }
> else
> {
> MemHandleUnlock(recH);
> }
> }
> FrmGotoForm(ViewTable);
> }
> }
>
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html