• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Access file


I'm writing a little windows application that uses data from an Access database.

Is there a way to change the access database file in a way you can't open it anymore with MSAccess ?

It should be only accessible within the application itself. But no one else should be able to get in there (exept me then :o) )

  • 2
  • 2
1 Solution
Bob LearnedCommented:
Not that I know of, but there is another place to ask Access questions:


If you view an Access Database in notepad you will see "Standard Jet DB" in the header.
 Changing this information will cause the database to become unreadable via Access.

'do not change it manually in word editor- db will be corrupted ( do it only through this proc)
'but it can be done in hex editor

Here is an example in VB6. It can be easily converted to VB.NET. I am just lazy to do it

Private Sub Lock_Database(sPath As String, iAction As Integer)
Dim iFreeFile   As Integer
Dim lLoop       As Long
Dim lLoc        As Long
Dim sString     As String
    iFreeFile = FreeFile() 'Get free file #
    Open sPath For Binary As #iFreeFile 'Open specified file for binary I/O.

    lLoc = 1 'Set starting byte location
    Select Case iAction 'Set the header string for the appropriate action.
        Case 1
             sString = "MYDB Database!!" 'Modified header data.
        Case 2
             sString = "Standard Jet DB" 'Default header data.
    End Select
    For lLoop = 5 To 19 'loop through and update byte positions 9 through 15.
        Put #iFreeFile, lLoop, Mid$(sString, lLoop - 4, 1)
    Next lLoop

Close #iFreeFile

End Sub
Jerry_0001Author Commented:
I tried your solution.

It locks and unlocks the database fine so you can't access it with MSAccess.

But the problem is that when it's locked, you also can't access it through the .NET program...

Of course you cannot, But in .NET program you can unlockit first , do something and then lock it back
Jerry_0001Author Commented:
Stupid of me :o)

That does the trick.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now