Hard-Lock a Table

Hard-Lock a Table

In many applications, I want to make absolutely sure that the data in a Jet table doesn’t get modified under any circumstances. I hard-lock the table in addition to using any system-level security to protect it. Also, this hard lock stays with the MDB if it is issued with an application.Place the expression True=False into the ValidationRule property of the table to lock it. The Jet evaluates this expression to False and blocks updates to the table:

 'DeclarationsPublic MyDB As DatabaseDim Dummy As Integer'Sample callsDummy = HardLockTable("UnLock", "TestTable")Dummy = HardLockTable("Lock", "TestTable")Function HardLockTable_	(ByVal whichAction As String, _	ByVal aTable As String) As IntegerOn Error GoTo HardLockTableError'Default returnHardLockTable = TrueSelect Case whichActionCase "Lock"	MyDB.TableDefs(aTable).ValidationRule = "True=False"	MyDB.TableDefs(aTable).ValidationText = _		"This table locked via " & _		"ValidationRule on " & NowCase "UnLock"	MyDB.TableDefs(aTable).ValidationRule = ""	MyDB.TableDefs(aTable).ValidationText = ""Case "TestThenUnLock"	If MyDB.TableDefs(aTable)._		ValidationRule = "True=False" Then			MyDB.TableDefs(aTable).ValidationRule = ""			MyDB.TableDefs(aTable).ValidationText = ""	End IfEnd SelectHardLockTableErrorExit:		'subFlushDBEngine		'optional, see next suggestionExit FunctionHardLockTableError:		HardLockTable = False		MsgBox Error$ & " error " & _			"in HardLockTable trying " & _			"to " & whichAction & " " & _			aTable		Resume HardLockTableErrorExitEnd Function
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes