I was getting a NULL error after the delete.  If I used Remove... no
problem!  I found out in the knowledge base that the delete sets the record
to NULL before it moves it.  The Remove releases the chunk.

Now why on earth would that cause a problem?  I'm not trying to read from
the record.... I'm doing the same thing as I've done many times before!

Here is a sample of my code incase someone sees something I don't.


Boolean DeleteDistRecord(UInt index)
{
 TablePtr table;

/*******
 *  Error Checking :-)
 *

 Err error;
 Char str[10];

 doubleToStr(str, (double)index, 0, 0);
 FrmCustomAlert(DebugAlert, str, " ", " ");

                  *
          End of Error Checking :-) *
               *******/


 // Check response to Delete Alert
 if(FrmAlert(DeleteDistAlert))
  return(false);

 // Free Chunk - complete delete
 DmRemoveRecord(gDistDB, index);


/*******
 *  Error Checking :-)
 *

 // Set deleted bit
 error = DmDeleteRecord(gDistDB, index);

 if(error == dmErrReadOnly)
  FrmCustomAlert(DebugAlert, "Read Only", " ", " ");

 else if(error == dmErrIndexOutOfRange)
  FrmCustomAlert(DebugAlert, "Index Out of Range", " ", " ");

 else if(error == dmErrRecordArchived)
  FrmCustomAlert(DebugAlert, "Record Archived", " ", " ");

 else if(error == dmErrRecordDeleted)
  FrmCustomAlert(DebugAlert, "Record Deleted", " ", " ");

 else if(error == dmErrInvalidParam)
  FrmCustomAlert(DebugAlert, "Invalid Parameter", " ", " ");

 else
  FrmCustomAlert(DebugAlert, "Other", " ", " ");

 // Move Record with deleted bit to end of records
 DmMoveRecord(gDistDB, index, DmNumRecords(gDistDB));

                  *
          End of Error Checking :-) *
               *******/

 // Redraw Table!!
 table = GetObjectPtr(DisSelectDistanceTableTable);
 TblUnhighlightSelection(table);
 DisSelectViewLoadRecords(FrmGetActiveForm());
 TblRedrawTable(table);

 return(true);
}



Timothy D. Astle
Embedded Systems Programmer
ALT Group Inc.

People on Jolt cola write the funniest things.

                                     A-10 Obedience Guide,
                                     Kitty Hawk Studios





-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to