Protect Your Access VBA Code from Reverse Engineering

Compile Access database macros into native DLLs — your business logic, SQL routines, and data export tools stay hidden inside compiled bytecode.

Why VBA Password Protection Fails for Access

Access databases with VBA modules face a unique risk: the .accdb file contains both data and code in a single package. The built-in VBA project password can be removed in seconds using freely available tools, exposing your business logic, SQL queries, validation rules, and data processing algorithms.

Even converting to .accde/.mde format offers limited protection — the VBA code is compiled to p-code but remains recoverable with specialized decompilers. For commercial Access applications and database tools, this is not acceptable.

The Solution: Compile Access VBA to Native DLLs

VBA Padlock goes beyond .accde protection. It compiles your VBA modules into native 32-bit and 64-bit DLLs, replacing readable source code with protected bytecode. The compiled DLL has full access to Application.CurrentDb, DoCmd, and the entire DAO engine — your code works identically, but cannot be decompiled.

Your Access database (.accdb) keeps its forms, reports, queries, and tables intact. A thin VBA Bridge module handles communication between Access and the compiled DLL. Users open the database and work normally — they never see your protected code.

1

Write

Write your Access VBA modules in VBA Padlock Studio with full syntax highlighting and autocomplete.

2

Compile

Click Publish to compile into signed 32-bit and 64-bit DLLs. A VBA Bridge is generated automatically.

3

Distribute

Ship your .accdb with the bin/ folder. Users open the database normally — the DLL handles everything.

See It in Action

Left: your protected code compiled into the DLL. Right: the thin VBA caller in your Access database.

Protected Code (VBA Padlock)
Function ExportToCSV(TableName, FilePath, Delimiter)
    Dim DB, RS, Stream, FieldCount, i
    Set DB = Application.CurrentDb
    Set RS = DB.OpenRecordset(TableName)

    Set Stream = CreateObject("ADODB.Stream")
    Stream.Type = 2
    Stream.Charset = "UTF-8"
    Stream.Open

    ' Write header row
    For i = 0 To RS.Fields.Count - 1
        If i > 0 Then Stream.WriteText Delimiter
        Stream.WriteText RS.Fields(i).Name
    Next i
    Stream.WriteText vbCrLf

    ' Write data rows
    Do While Not RS.EOF
        For i = 0 To RS.Fields.Count - 1
            If i > 0 Then Stream.WriteText Delimiter
            Stream.WriteText Nz(RS.Fields(i).Value, "")
        Next i
        Stream.WriteText vbCrLf
        RS.MoveNext
    Loop

    Stream.SaveToFile FilePath, 2
    Stream.Close: RS.Close
    ExportToCSV = True
End Function
Caller Code (Access VBA Editor)
Sub ExportCustomers()
    Dim FilePath As String
    Dim Success As Variant

    FilePath = CurrentProject.Path _
        & "\Customers.csv"

    Success = VBAPL_Execute( _
        "ExportToCSV", _
        "Customers", FilePath, ";")

    If Success Then
        MsgBox "Export complete!", _
            vbInformation
    End If
End Sub

Access VBA Protection in Action

Real examples from Access projects protected with VBA Padlock.

Microsoft Access database using compiled and protected VBA logic
Protected Access database running with compiled DLL code.
Access VBA editor calling VBAPL_Execute bridge function
Thin Access VBA bridge that calls your protected functions.

What You Can Protect in Access

VBA Padlock supports all Access VBA scenarios — from database utilities to complete commercial Access applications.

Database Business Logic

Protect proprietary validation rules, calculation engines, and workflow automation that power your Access applications.

Data Export Tools

Secure CSV, JSON, and XML export routines that process sensitive database records with custom formatting.

SQL Query Engines

Hide advanced query builders, dynamic SQL generators, and reporting logic inside compiled DLLs.

Form Automation

Wire compiled DLL functions to Access forms and reports. Event handlers call your protected code seamlessly.

Access Application Distribution

Distribute complete Access applications with protected business logic. End users run the .accdb file normally.

Licensing & Activation

Add hardware-locked license keys, trial periods, and online activation to any Access VBA project — built into the DLL.

Access-Specific Notes

  • Use Application.CurrentDb (not just CurrentDb) inside compiled scripts.
  • The Access database must be in a writable location for license storage.
  • Filter out system tables (MSys* prefix) when iterating TableDefs.

Frequently Asked Questions

Can VBA Padlock compile VBA code from an Access .accdb database?
Yes. VBA Padlock compiles your Access VBA modules into 32-bit and 64-bit DLLs. You keep your .accdb file with forms, reports, and queries — the compiled DLL runs your protected code behind the scenes through a thin VBA Bridge module.
Does compiled code have access to Application.CurrentDb?
Yes. Your compiled VBA code retains full access to the Access object model including Application.CurrentDb, DoCmd, CurrentProject, and the DAO engine. One important note: always use Application.CurrentDb (not just CurrentDb) inside compiled scripts.
How do I protect Access forms that call VBA functions?
Move your business logic into VBA Padlock scripts, compile them into a DLL, then call them from your Access forms using the VBA Bridge. Form event handlers call VBAPL_Execute("FunctionName", params) — the forms themselves remain in the .accdb file as usual.
Can I distribute a protected Access application to end users?
Yes. You distribute the .accdb file alongside a bin/ folder containing the compiled DLLs. End users only need Microsoft Access (2016 or later, 32-bit or 64-bit). No runtime or additional software is required. You can also add license key activation to control distribution.
Does VBA Padlock protect my SQL queries inside the Access file?
VBA Padlock protects VBA code that generates or executes SQL queries programmatically. Queries stored as Access query objects remain in the .accdb file. To protect sensitive SQL logic, write it as VBA code in VBA Padlock scripts rather than as saved Access queries.

Ready to Secure Your VBA Code?

Download VBA Padlock and start compiling, protecting, and licensing your VBA macros today.