Protect Access program

Posted on 2014-04-25
Medium Priority
Last Modified: 2014-05-16
I have developed a program in Access2010.
I would like to protect it from copying the source.
How to protect the piracy?

What is the normal procedure to protect copying?
Is it possible to give them as an exe with the source codes protected?

And there is user authentication.
How to control the number of user?

I want only 2 users to be logged in at a time.
Question by:MAS (MVE)
  • 5
  • 4
  • 3
LVL 59
ID: 40022452
With Access, you cannot generate a standalone EXE.

You can distribute your database with a password on the VBA project to protect the source code.   In addition, you can also distribute as a "compiled" app, which is a MDE.  This is a DB with the source code stripped out.

Even with all that however, someone who is very determined could still figure out your code.

To help with that, you could use:


In terms of registering/securing your app from a licensing standpoint, there is this:


LVL 86
ID: 40022539
And there is user authentication.
How to control the number of user?
I want only 2 users to be logged in at a time.
You'd have to control that yourself. Essentially, you'd have to log users when they connect, and log them out when they disconnect. This can be tough to do, especially if you have users who are in the habit of using the power button on their machine to log out.

What's the reason for having only 2 users? If this has to do with licensing, then I'd suggest something like what JimD suggest, or this: http://www.ssware.com/cryptolicensing/cryptolicensing_ocx.htm. This is an industrial strength library that will do what you need. I use it for my .NET projects, but I've used the ActiveX version as well.
LVL 29

Author Comment

by:MAS (MVE)
ID: 40033878
I have user authentication.
But not sure how to control that. I have a table to store username and password.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

LVL 86
ID: 40034204
Not sure how to control what?

If you only want two users in the database, then when User1 logs in you would write a record somewhere (perhaps you'd have a Logins table). When User2 logs in, you check the Logins table to see the number logged in. If it's less than 2, you allow User2 to log in.

When User1 logs out, you either remove that record from the Logins table, or you "close" it (i.e. stamp it with the logout date/time).

The trouble comes when User1 doesn't log out, but instead uses the power button on the machine to close it out, or when the network drops, or any of a dozen other scenarios. When these happen, the Logins table is not updated, and the system will consider User1 to still be logged in.

So back to my comment:

What's the reason for having only 2 users
If you can let us know why you only want two users logged in, we might be able to provide you with better suggestions.
LVL 29

Author Comment

by:MAS (MVE)
ID: 40034220
I started with 2 users. Now they are telling me to give them a user with admin permission to create another user so only 2 users can login at the same time.
Note: I told them you can keep only upto 4 active users.
LVL 86

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 40034241
Okay, then the technique I suggested would be a good starting point - but as I mentioned, there are quite a few pitfalls with this technique. You would be much better off with a commercial licensing utility that sits outside of the program, and monitors activity. The utility I suggested (CryptoLicensing) does these things, but it's not free (or cheap, for that matter).

I'm also curious if you could use the Jet Roster method for this:


Basically, this "reads" the lock file and determines the number of users in the system. Note that connecting to the lockfile will create a user, so you'd have to account for that  -  - in other words, if two users are in the system and you use the Jet Roster method, it would show 3 users, not 2. You could modify the VBA code sample from that page like this:

Dim iCount As Integer

With rstTmp
    Do Until .EOF
       iCount = iCount + 1      
End With

If iCount > 3 Then
  Msgbox "More than 2 users are not allowed"
End If
LVL 59
ID: 40034248
The comments that Scott and I posted at the start contain everything you need to protect your app and control the number of users.

Note that were assuming that you telling them they can only have 4 users is a restriction you want and not a problem with the app.

 A well written Access app can handle 30 to 40 users without issue and if a SQL server backend, more than that.

LVL 29

Author Comment

by:MAS (MVE)
ID: 40055498
One more thing I have seen one of my friend did this. He just run the exe automaically a shortcut created on desktop and db copued to c drive. I think he just coped the shortcut and and copied the db and created as a package in VS2010.
I am not sure of how he did that or he got it from somewhere else.
Any idea of how it will be?
LVL 59
ID: 40055894
With Access, you cannot create a standalone .exe

Either the Access run time or the full Retail version must be installed in order to use the DB (they are in fact one in the same, it's just some registry keys that controls the "mode" your allowed to use it in).

I would assume what your friend did is created an install package that included the run time version of Access along with the DB.

LVL 29

Author Comment

by:MAS (MVE)
ID: 40056897
Yes you are right I saw first it installed runtime and copied the DB.

How to do the same?
LVL 59

Accepted Solution

Jim Dettman (Microsoft MVP/ EE MVE) earned 1000 total points
ID: 40057239
<<How to do the same? >>

There are a couple methods:

1. Manual - Point them to the runtime download on Microsoft's site and then give them a copy of the DB with instructions to install.

2. Create an install package with:

a. VS as your friend did.
b. The Access publish wizard (leaves lots to be desired, which is why your fired probably used VS).
c. Many use INNO setup with good results (http://www.jrsoftware.org/isinfo.php and it's free).
d. Purchase Sagekey scripts.

 The last d, is the most preferable.  Sage has been around for a while, and their install is first rate.  It gives you a totally isolated install from anything else that may be installed on the machine.  Your app will work every time no matter what else that's Access based has been installed there.  Details here:


LVL 29

Author Closing Comment

by:MAS (MVE)
ID: 40071752

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Audit trails are very important in any system to hold people responsible for certain transactions and hold them to take ownership of their actions. This article is dedicated to all novice "Microsoft Access" developers.
If you need to implement application level security in an Access database application or other VBA code, I strongly encourage you to take advantage of Active Directory groups.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question