Here is something else that confuses me:
void SaveRecord(DmOpenRef db, void *item, UInt16 RecNum)
{
UInt16 size = PackedRecordSize(db, item);
void *newRecordH = DmNewHandle(db, size);
void *newRecordP = MemHandleLock(newRecordH);
MemHandle recordH = DmGetRecord(db, RecNum);
//Pack the record
PackRecord(db, item, newRecordP);
MemPtrUnlock(newRecordP);
//Detach the old record from the database
DmDetachRecord(db, RecNum, &recordH);
//Attach the edited record to the database over the previous record
DmAttachRecord(db, &RecNum, newRecordH, NULL);
//Get rid of the previous record
MemHandleFree(recordH);
//FATAL ALERT ON THE FOLLOWING LINE BECAUSE THE DB ISN'T BUSY
DmReleaseRecord(db, RecNum, true);
}
So this code seems wrong according to the need for matching
DmGetRecord and DmReleaseRecord. If I add a DmGetDatabaseLockState
prior to DmReleaseRecord to check if there is a busy record and
then use DmReleaseRecord if it is busy then that works. Except that
is NEVER busy because of the DmDetachRecord. Without the
DmDetachRecord, DmAttachRecord says that the record is busy. So
does this qualify as an exception to the DmGetRecord -
DmReleaseRecord pairing?
I discovered that the code was modified this way because the
DaVinci API creates default records when you go to make a new
record so you are ALWAYS removing the default record and attaching
your new record in the DaVinci SaveRecord API.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/