把表达式True=False放到表的ValidationRule属性就能锁上。HardLockTable?实现了该功能。
声明
PublicMyDBAsDatabase
DimDummyAsInteger
函数
FunctionHardLockTable(ByValwhichActionAsString,?ByValaTableAsString)AsInteger
OnErrorGoToHardLockTableError
HardLockTable=True
SelectCasewhichAction
Case"Lock"
MyDB.TableDefs(aTable).ValidationRule="True=False"
MyDB.TableDefs(aTable).ValidationText=?"Thistablelockedvia"&?"ValidationRuleon"&Now
Case"UnLock"
MyDB.TableDefs(aTable).ValidationRule=""
MyDB.TableDefs(aTable).Va...[ 查看全文 ]