Question MS Access file should only open when the filename is the same as record (1 Viewer)

anski

Registered User.
Local time
Today, 13:56
Joined
Sep 5, 2009
Messages
93
Example: Field name is companyname. companyname = hersheysintl.accdb

For a user to be able to open this MS Access file, the name of the MS Access file should be hersheysintl.accdb. Otherwise, the file will not open. Is this doable?
 

isladogs

MVP / VIP
Local time
Today, 06:56
Joined
Jan 14, 2017
Messages
18,261
This is a very strange request.
If a user has appropriate permissions to the folder where a file is stored they will be able to open it.
However you could create a CheckCompany function to run the check stated and if the check shows a difference, show a message then quit the app.
You would need to run the function from an autoexec macro.

BUT unless you build in a code bypass, you will also be locked out of this app yourself.
If you do build in a bypass, others may also use it to gain access.

It would also be possible to do this check using a separate starter app which would only open the main app if the check showed a match.
Similar idea but that may be a slightly better solution as it would prevent the main app being opened just to run the check.
However as already stated its a very strange request.
 
Last edited:

anski

Registered User.
Local time
Today, 13:56
Joined
Sep 5, 2009
Messages
93
Thanks for the suggestion.

To give you a background, I have a simple bookkeeping program. (Date, account title, debit or credit amount.) I am planning to give an accountant a copy of this program. The Company Name will be entered by me. Table Company only has one field and that is companyname.

If the accountant has two clients and she would like to use the bookkeeping program for her second client by just copying the original file (hersheysintl.accdb) and renaming the latter to another file (bookstore.accdb), she would not be able to open the bookstore.accdb file because the latter's filename <> hersheysintl.accdb.

I am hoping to do this with just one program.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:56
Joined
Oct 29, 2018
Messages
21,542
Hi. Pardon me for saying this; but even if you can limit the accountant from changing the filename, he or she would still be able to use the program for another client by simply using the same filename in another folder, and they'll be free to store another company's data in it. Just a thought...
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:56
Joined
Feb 28, 2001
Messages
27,321
Whatever man can create, man can destroy - including this kind of copy protection. You are not going to be completely successful in such a scheme because Access cannot hide its data completely. Someone with skills at a par with your own - or someone who reads this public forum - will be able to defeat your scheme, particularly since it is table-dependent. For example, what if they just rename the darned file and run it under a name that doesn't match the company's actual name. So to use your example, what if MarsCo decides to use this app and name the file HersheyIntl?

EDIT: I see theDBguy recognized the same flaw. But I had a longer message following it.

You MIGHT be able to get away with some sort of code-based scheme where you create a hard-coded item in VBA that uses an encryption scheme to hash-encode the name you are looking for but usually the trick will be some sort of two-stage approach. You CAN write a registry key and if you make it a hashed key based on, say, the computer's hardware serial number or some other such item, you can lock it down to that machine. There are other schemes. You would have to search this forum for "licensing a database" because this isn't the first time someone has asked such a question.

I think invariably, your issue is that you can't trust your customers. But what you might do is perhaps hide some CDO code somewhere that if your software is used on a new machine based on this being the first time you see a given serial number, send a message to yourself. (Of course, that requires that the internet be up, but you can make that a requirement, and you can refuse to run if the CDO .Send operation fails.) Then confront the person to whom you gave that copy. And the code could identify itself as well based on contract numbers or such. You could not stop this bootleg use - but you could at least know about it and initiate legal action.
 

anski

Registered User.
Local time
Today, 13:56
Joined
Sep 5, 2009
Messages
93
Hi. Pardon me for saying this; but even if you can limit the accountant from changing the filename, he or she would still be able to use the program for another client by simply using the same filename in another folder, and they'll be free to store another company's data in it. Just a thought...

That is true but all the forms AND reports will still have the name of the original company. As an accountant myself, I would not want to be printing reports that have the incorrect company name splattered all over the reports. Yes, I could use correction tape/liquid paper and manually write the correct name but I consider that a hassle.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:56
Joined
Oct 29, 2018
Messages
21,542
That is true but all the forms AND reports will still have the name of the original company. As an accountant myself, I would not want to be printing reports that have the incorrect company name splattered all over the reports. Yes, I could use correction tape/liquid paper and manually write the correct name but I consider that a hassle.
Hi. But there's nothing stopping the user to export the data to Excel and create their own reports. Or, link the data to a new database where they could create reports. Or, they could just create new reports in your app as well. Couldn't they?
 

anski

Registered User.
Local time
Today, 13:56
Joined
Sep 5, 2009
Messages
93
Hi. But there's nothing stopping the user to export the data to Excel and create their own reports. Or, link the data to a new database where they could create reports. Or, they could just create new reports in your app as well. Couldn't they?

That is true.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:56
Joined
Feb 19, 2002
Messages
43,484
I built an app which was sold to the public that had a similar type of requirement. The app was used to do a benefits audit. In some cases, the app was purchased by a company for its own internal use and in others, it was purchased by a third-party who used it to perform the audits for multiple clients. This seems to be your situation. You want to control the number of companies that the database can be used for.

In our case, the product was licensed for x concurrent audits. So a company doing its own internal audit would buy 1 license. They would perform the audit and archive the results. The following year, they could do another audit using their single license. Or, they could run the audit all year and do a department at a time. The point was that they could have only one active audit at one time. For the clients who were performing audits for other companies, they might buy 3 or 10 licenses depending on how many concurrent audits their staff could handle.

The only way to control this is to have ONE back end database to hold the data for ALL the concurrent audits and you could do something similar. The way you control the concurrent audits or clients or whatever is by limiting the number of rows in the top level table. So in our case, we allowed only as many records in the audit table as the customer purchased licenses for. Your case would be clients. So the application allows only x client records depending on how many licenses the account purchases.

To facilitate this, I wrote code to generate a "token" that was given to the purchaser of the application. In it was encoded the number of licenses and the end date of the license period as well as several other y/n options applying to features the client elected to purchase as extras. So 1 license for 1 year or 3 licenses for 1 year or 6 licenses for 2 years. Whatever we agreed on. In our case, we weren't really worried about the customer giving the software to some other company since any other company would be a competitor of theirs and why would they give them something of value with which to beat them in the marked. It was more likely that they would try to use the software for more audits than the bought or to use the app after the expiration date. Our code prevented both of those things from happening.

One thing we never implemented because it seemed to be over kill but which you might want is to have the software either log into a web page periodically and send you the name of the BE it was linked to or if the user used the relink form, which our app included), that might be where you want to send yourself an email so you could determine if the client was cheating by linking/relinking every day to work on a different BE so he could support more customers.

Make the cost of a license reasonable enough that your customers won't have any real incentive to circumvent your licensing and make your contract have real punishments should the client be found to be violating your terms.

I can't give you the code I used to generate/interpret the token but I can give you some guidance on how I did it. PS, if you go with the "ET phone home" techniques, you must inform the client and have it included in your contract so they know what information you are going to send yourself.
 
Last edited:

Users who are viewing this thread

Top Bottom