If you're just iterating through all the records anyway (since the category
argument to DmQueryNextInCategory() is dmAllCategories) why not just use
DmQueryRecord()?
Untested code:
totalNumber = DmNumRecords( gSRWorkDB );
for ( iRec = 0; iRec < totalNumber; iRec++ ) {
recordH = DmQueryRecord( gSRWorkDB, iRec );
if ( recordH ) {
...
}
}
-Bob Whiteman
"Edward P. Ross" <[EMAIL PROTECTED]> wrote in message
news:82978@palm-dev-forum...
>
> I am iterating through a database and getting the number of records that
match the search criteria as seen below. Problem is
> that p1 gets stuck on the first value and never changes. It does loop
through the correct num of times but p1 stays the same.
> It's probably something stupid but it's Friday...
>
> Any help would be appreciated.
>
> Thanks,
> Ed
>
> // Code to visit every record:
> for (i = 0; i < totalNumber; i++) {
> recordH = DmQueryNextInCategory (gSRWorkDB, &pos,
dmAllCategories);
>
> if (recordH) {
> skelSRWorkDBType * p1 = (skelSRWorkDBType *)
MemHandleLock(recordH);
>
> if (p1) {
> if ((StrCaselessCompare(selectedClientText, (Char *)
&(p1->PUN)) == 0) && (p1->Date >= daysInRangeL) &&
> (p1->Date <= daysInRangeH)) {
> number = number + 1;
> }
> MemHandleUnlock(recordH);
> }
> }
> pos++;
> }
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/