This was a question I received on one of my YouTube videos.
“That’s good. But how to protect this access database to be limited to certain number of PCs. Because if you copy this database to your friend and give him the password he can give it to another person and so on. What I would like to know is How to protect Access database and limit to certain computers
Thanks Again.”
My response is to:
Check the computername on login and only allow computers that are in your table into your database.
Save your database as an accde
Here’s the plan:
“frmCheck” will load when the database loads, and will check the computer trying to access the database.
When “frmCheck” loads we will use the “Environ” function to check the current computer name:
Environ(“ComputerName”)
Only the computer names listed in “tblComputerAllowed” are allowed to access the database.
This code will check against the list of computers and kick out anyone who is not allowed:
Private Sub Form_Load() Dim strComputerName As String strComputerName = Environ("ComputerName") If Not IsNull(DLookup("[c_ComputerName]", "tblComputerAllowed", "[c_ComputerName]='" & strComputerName & "'")) Then MsgBox "Welcome. You may enter." Else MsgBox "You are not authorized to be here and the database will shutdown." Application.Quit End If End Sub
Here is the table the code checks:
If your computer name is “All03dComP” then you are allowed to open the database, otherwise you are kicked out.
(If you accidentally make yourself “not allowed”, bypass the open form by holding the “Shift” key down while you open the database.)
Let me know if you have any questions.
Watch how it’s done:
restrict user logon to specific computer
How do I handle errors in Access VBA code?
I am going to give you the answer to “How do I handle errors in Access VBA code?” In my opinion there are 2 ways to handle errors: 1. Avoid the potential for an error to occur. 2. Handle the error in your code. Number 1 – If you have a control on your form […]
What Is Microsoft Access Used For?
To those of you who are asking the question of “What is microsoft access used for?” , here is my opinion. I’ve been using this program for well over 15 years, and it’s become fairly easy to deal with. Many people feel that it is hard to work with, but that’s not my experience anymore […]
How To Make An Access Select Query
Hi everyone, This is not really a VBA item, but it’s important and you will need to understand this concept when you are creating your SQL statements in VBA. In our example we have a table called “Customers”: Now we just want the customers from “London”. So we set up a select query to select […]
How To Generate A XML File With Access VBA
XML is used to structure your data. You can send a CSV file to another person, but using XML, you can structure your data in a more elegant format, and get very specific about your fields, and what data is contained within your tags (your field names). This is different than a basic CSV file […]