I am trying to prevent a record from being deleted unless it is the last record. I thought I had found a solution, following the ideas
explained at How to know when last the record in a selection is reached? and Determine Last Portal Row? to try the privilege
settings. But then hit a snag.
I created a privilege set and assigned “user” to it. I’ve then gone into “Data Access and Design” and set:
Records to (initially) create, edit and delete in all tables
Layouts to All view only
Value Lists to all modifiable
Scripts to All executable only
.. and, eventually, Available menu commands to All
This effectively allowed the required access to my layout.
Then in order to restrict to deletion of last record only I updated:
Records to Custom privileges.
In the Custom Record window I set everything to yes, except the delete of my particular table. I Set the option to limited and entered the
following in the calculation window:
Get ( RecordNumber ) = Get ( TotalRecordCount )
On logging on as “user” everything appeared okay at first. But then I found I could add new records and delete those.
I am speculating that what is happening is that on opening TotalRecordCount is say 175. I cannot delete record 175. If I add record 176. I
can delete it (because it is not record number 175). So it appears as though the TotalRecordCount is not being updated. Is my reasoning correct and if so is there a way to force a refresh (that effects the privilege set) when needed?
Presumably, an alternative would be to disable the Menu Commands and add some buttons to the layout to control “add” and “delete”.
Thanks for any feedback.