How To: Keep certain tables from being edited in a project [SCRIPT]
How to prevent certain tables in a project from being edited.
The following sample code keeps selected tables from being edited. There are three scripts that are set into the project file. Two of them are set to the click/update events for a new button that must be created on the Table bar. The "locking" is actually disabling the editing function for certain tables.
'------ Start Script 1
'--- This script sets a global variable for the other two scripts to use.
'--- Set this script as an Update script under the Project GUI.
'--- Create a new menu choice for this task and make it invisible.
'------ End Of Script 1
'------ Start Script 2
'--- This script gets the tables you wish to keep from editing. Each locked table will
'-- be tagged with the string "locked"
'--- Set this script as the Click event.
'--- Create a new button in the button bar for this task.
aFile=msgbox.input("Name of table to Lock:", "Lock Box","")
if (aFile = nil) then
elseif (aDoc=nil) then
("Table "+aFile++"does not exist, try again","Table doesn't exist")
_lockList.Add(aFile) 'adds your table names as strings to a list
Yn=msgbox.MiniYesNo("Do you wish to add another table?", false)
if (Yn = false) then
msgbox.listAsString(_locklist, "Your Locked files","")
for each i in _locklist
'------ End Of Script 2
'------ Start Script 3
'--- This script searches for the tables that are to be kept from editing and locks
'-- them out.
'--- Set this script as the Update event for the new button that should have
'-- been created earlier.
if (aDoc.GetObjectTag="Locked") then
elseif (aDoc.GetObjectTag=nil) then
'------ End Of Script 3