Question MS Access file should only open when the filename is the same as record

anski

Registered User.
Local time
Today, 16:48
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?
 
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:
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.
 
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...
 
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.
 
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.
 
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?
 
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.
 

Users who are viewing this thread

Back
Top Bottom