MS ACCESS 2007 Create simple internal password to open a Form

Posted on 2013-09-23
Medium Priority
Last Modified: 2013-10-01
Password to DB not necessary.
We want the DB open to all PH users.
However, there is one Adm user that needs to have a simple (No encrytion, etc needed) to open the Adm Menu Form.
Question by:willjx
LVL 19

Expert Comment

by:Eric Sherman
ID: 39516432
See this post ... I posted this solution to a similar question last year.


LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39516528
LVL 21
ID: 39516536
Since this is a multi-user database you will need to have it split into a front end and back end.

In that case, I like to keep it keep it simple and put the put the admin forms and etc into a separate front end?
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.


Expert Comment

ID: 39516946
Why do you want your admin to remember another password?
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If ( lngX > 0 ) Then
        fOSUserName = Left$(strUserName, lngLen - 1)
        fOSUserName = vbNullString
    End If
End Function

Open in new window

Compare fOSUserName() result with your admin username and based on that enable/show  button running your Admin form.

Author Comment

ID: 39533921
Sorry for not getting back sooner.  I like the idea.  However,
I tried the code without success.
I'm not a VB person. I sent it to a couple of system IT people in my dept., and they couldn't help with where I probably have to modify it to fit my environment.
I was actually looking for something much simpler that could just use the ACCESS query system inasmuch as there is no need for special security -just a method to prevent users other than the administrator from stumbling into the Adm Menu.
LVL 21
ID: 39534307
I was actually looking for something much simpler that could just use the ACCESS query system inasmuch as there is no need for special security -just a method to prevent users other than the administrator from stumbling into the Adm Menu.

The simplest way I know is to place the admin menu and objects in a separate  front end.  I use this method a lot.

FWIW: For any type of security to be effective it will not be that simple to create. If if is, then it will usually also be very easy to circumvent.

I agree with slubek, that if possible compare the Windows user name to a list of admin users to allow access to the admin menu and objects.
LVL 21

Accepted Solution

Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 2000 total points
ID: 39534548
I put together an example that you can import into your database and use

It has two forms:
1) Use a password
2) Uses Windows user name

See attached:

Author Closing Comment

ID: 39537560
Thanks much...

Featured Post

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'.

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

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.
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

621 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