As I got to see that this forum is really trying to help access programmers , I decided to use it to post my article in here
to benefit its seekers .
Please do note the following :
Methods applied are unconventional and rely on my experimentation of the situation since I got to realize that there were
minimal documentations for our subject of discussion J
Also please pardon my English , I've did my best yet it’s a fact that English is my third language.
Why wouldn't Microsoft make it easy to compile an MS Access Project into a distributed executable?
1 – Microsoft has managed to create a monster by creating MS Access , and by realizing the risk and the fact that they would
have to put many applications (such as Axapta , Great Plains , mind you Visual Studio .net) to sleep , they had to cripple it
a little from being a developers platform and tam it into becoming a small business solution.
2 – For a peculiar reason programmers through-out time have always been valued based on complexity and not on achievement (So
an Oracle programmer would get paid for developing a phone book application yet an Access Programmer gets a tap on the back
which leads elite programmers to refrain from such beast called Microsoft Access.
Now , Now enough chit chat and let's get to work:
Step 1 : Make sure that your application security is not reliant on Microsoft Security file .mdw (for many reasons 1st its
unsecured , 2nd it would still give away that this is an MS Access application, 3rd it would conflict with users who have
other access applications installed on their own PCs who are about to use yours) you will have to script your own security
modal which isn’t so difficult , all you need is to script a login form , an administration form , and every form and report
on your application to check if authorized to run or edit (On_Open event) and thus leading the Form/Report to close
"DoCmd.Close Form.Name" Or denying data manipulation through "Form.AllowEdits = False" / "Form.AllowDeletions = False" (I am
trying to make it look simple so you wouldn’t cry).
Step2: Make sure you have scripted your own menus and tool bars (it's easy and fun so don't you get lazy).
Step3: Make sure your Startup Form is selected , your databse window is set to hide and that you have your own icon installed
as project and form icon (Insert icon in your project folder , use string ".youriconname.ico" instead of full path because
usually paths vary PC to Another
Step4: Implement Microsoft Script disabling "Startup Form Over-ride by using Shift Key"
Create New Model :
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing
If Err = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
SetProperties = False
MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
Now Create a label named bDisableBypassKey and add the following code to its Click event :
Private Sub bDisableBypassKey_Click()
On Error GoTo Err_bDisableBypassKey_Click
'Dim strInput As String
'Dim strMsg As String
'strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Please key the
'programmer's password to enable the Bypass Key."
'strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
'If strInput = "TypeYourPasswordHere" Then
' SetProperties "AllowBypassKey", dbBoolean, True
' MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & "The Shift key will allow the users to bypass the startup
options the next time the database is opened.", vbInformation, "Set Startup Properties"
SetProperties "AllowBypassKey", dbBoolean, False
' MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & "The
Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", vbCritical, "Invalid
' End If
MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
(above script is a raw and dangerous script , if not handled with care you might end up losing designer's access to your
project also do note that I have managed to disable its back door since you shouldn’t be leaving such an advantage in the
hands of end users) .
Also do not click your disable label until final stage of operation.
Step5: Cover all your form errors with proper addressing messages or procedures (Unlike MS Access , programs shouldn’t
generate run time errors , and usually a program with a runtime error will crash and exit), now for an easy solution for
those who are lazy enough use the general Form Error section and add the following (On Error Resume Next) or maybe add a
message box or two stating that an error has occurred and user should be more careful (You lazy you!).
Step6: Create a .mde file (Save your VB scripts from being stolen until someone comes up with a proper tool to decode it ,
you can also skip this stage if you like , or if for a peculiar reason Microsoft Access denied it -Happens with huge
Step7: Create a photo dimensioned 362x290 pixel (Smart developers tried 1x1 pixel image which worked up fine on their
platforms but generated errors and crashes on other users' platforms so stick to the standard , oh and darken the area where
Microsoft overlays its version details ) in BMP format as your splash screen (This will replace Microsoft Access splash
screen on running), give it the same name as your database/project (i.e if your database/project is named myproject.mdb etc.
name your photo myproject.bmp ) and place it in your project's folder.
Step8: Rename your database / project file extension (The neat trick) into dll (i.e if your database / project is named
myproject.mdb etc. name it myproject.dll ), Also move security workgroup file (system.mdw usualy) used while database
creation to project's folder and rename its extension into ocx (i.e if your security workgroup file is named myproject.mdw
etc. name it myproject.ocx ).
Step9 : Create a Visual Basic 5 or higher project (Lets get down and dirty for a minute) that all to be done is to run a
shell command (Batch file like executable) running the following code in Open event of its Startup Form:
Dim strPathToProgram As String
strPathToProgram = App.Path & "MSACCESS.EXE " & App.Path & "myproject.dll /wrkgrp " & Chr(34) & App.path & "myproject.ocx" &
Shell ("" & strPathToProgram & "")
while making sure Form Parameter "Make Visible in Taskbar" is set to False , Startup Form is invisible and then compile
it to the same Project Folder (Adding up an icon file wouldn’t hurt).
(Now attached to this article you will find the source code to such project and a compiled example of its EXE)
Step10 : Keep a copy of file MSACCESS.EXE usually found in Microsoft Office folder in Program Files to your project folder
(Saves Junior programmers the hassle of searching registry for Microsoft Office or Microsoft Access Runtime installation
folder , also note that this doesn’t work with MS Office 2007 in which case you have to make your executable file created on
Step9 lookup MS Office 2007 installation path in registry key "HKEY_LOCAL_MACHINE SOFTWARE Microsoft Office 12.0 Access
InstallRoot : Path" value and add it to your shell command).
Et Voila !
1 - Now do note the following , your project is still reliant on Microsoft Office Access and while I do know how to make it
un-reliant , the technique to it is still illegal as it requires certain tampering to Microsoft Access Runtime files
installation and registration technique which Microsoft denies.
2 – It is better to include Microsoft Access Runtime environment 2000 / 2002 and not 2003 or 2007 to your installation as you
will be faced upon first start by MS Access confirm security level of application which is a confusing dialogue to end
Download Link to Access Runtime environment 2000 :
3 – You can always use command line switches to stealthily install Microsoft Access Runtime during installation of your
application which I recommend setup factory as an installation packager of choice (A bit techy here).
4 – Finally do note that Command Line switches of Microsoft Access malfunctions if paths include spaces so do try to
restrict/deny installation paths that is not compliant with old dos fundamentals of naming (A bit techy here).