Branding a Jet MDB File

Branding a Jet MDB File

This routine allows a hidden table to be appended to the Tables collection in an MDB file. I use the table name as a brand or stamp. During development, I change the brand when design changes are made to the MDB file. Access tables with Msys and Usys preambles are treated as hidden objects by the Jet database engine. The default setting is hidden. The brand starts with UsysBRAND.I prefer using the table name to using a record in a predefined table because it is more difficult for a casual user to delete a table than it is to delete a record from a table:

 Public MyDB As DatabasePublic Const BrandString = "UsysBRAND"Dim Dummy As IntegerDim outputVariantSet MyDB = OpenDatabase("testjet3db")'Some test callsDummy = MDBrand("clearbrands")Dummy = MDBrand("stamp", "TheTestProject")If MDBrand("read", outputVariant) Then	Debug.Print outputVariantEnd IfIf MDBrand("validate", "TheTestProject") Then	Debug.Print "ProjectTest"End IfPublic Function MDBrand(ByVal whichAction As String, _	Optional aString) As IntegerDim MyTableDef As TableDef, _	MyField As FieldDim TempString As StringDim i%	On Error GoTo MDBrandError	'Default	MDBrand = False	Select Case whichAction		Case "clearbrands"			For i% = MyDB.TableDefs.Count - 1 To 0 Step -1				If Mid$(LTrim$(MyDB._					TableDefs(i%).Name), _					1, Len(BrandString)) _					= BrandString Then					MyDB.TableDefs.Delete _						MyDB.TableDefs(i%).Name					DoEvents					DBEngine.Idle					DoEvents					MDBrand = True				End If			Next i%		Case "read"			For i% = MyDB.TableDefs._				Count - 1 To 0 Step -1				If Mid$(LTrim$(MyDB._					TableDefs(i%).Name), _					1, Len(BrandString)) _					= BrandString Then					MDBrand = True					aString = Mid$(LTrim$(MyDB.TableDefs_						(i%).Name), Len(BrandString) + 1)				End If			Next i%		Case "stamp"		TempString = BrandString & aString & CStr(Now)			If Len(TempString) > 40 Then				TempString = Mid$(TempString, 1, 40)			End If			Set MyTableDef = MyDB.CreateTableDef_				(TempString)			Set MyField = MyTableDef._				CreateField("MyDate", dbDate)			MyTableDef.Fields.Append MyField			MyDB.TableDefs.Append MyTableDef			Set MyField = Nothing			Set MyTableDef = Nothing			MDBrand = True		Case "validate"			For i% = MyDB.TableDefs.Count - 1 To 0 Step -1				If Mid$(LTrim$(MyDB.TableDefs(i%)._					Name), 1, Len(BrandString)) = _					BrandString Then					If InStr(MyDB.TableDefs(i%)._						Name, aString) Then						MDBrand = True				End If				End If			Next i%	End SelectMDBrandErrorExit:	Exit FunctionMDBrandError:	MDBrand = False	Resume MDBrandErrorExitEnd Function
Share the Post:
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

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as