How to Password Protect a Form or Report in Access
by Shane Zentz
Microsoft makes doing a lot of things with databases very easy. And password protecting a form or report is no exception. With just a few lines of code in the right place you can prevent unwanted users from opening and viewing or editing data in your form or report. Just as an aside, this is not the most secure method and in fact is not really secure at all. But in order for someone to find the password (which is hard-coded into the application) they would have to have at least basic knowledge of access from the design and programming point of view, so if they are just users then chances are that they will never discover the password (by looking at the code behind the program) unless someone tells it to them or they discover it written down somewhere. Having said that, this method is still pretty useful for just average applications, like I said it is not really the most secure method, so if your application contains really sensitive data (like social security numbers or bank account numbers) then I would advise using another more secure method. But if you just need a basic password protection to protect just one or a few forms from average users then this method will work and it is also quick and very easy. So read on to see how this is done.
Open the form or report that you want to password protect in design view and find ‘form’ in the properties field (see photo 1). Then switch to the events tab. Under the events tab you will see a field called ‘on load’ (see photo 1), this is the field that controls what the form or report does when it is first loaded or opened. Here we want to add some code to the on load event so that it will first prompt the user for a password. So click on the tiny icon with the three little dots on it and on the window that pops up, select ‘code builder’. This will bring up a Visual Basic window (see photo 2) which will have a method for the ‘onload’ event preloaded. All we need to do is to add the code to this section.
Here is the code:
Dim PassWord As String
PassWord = InputBox(“Enter Password”)
If PassWord = “whatever password you choose here” Then’
Open FormDoCmd.OpenForm “name of the form that you want to password protect”
ElseMsgBox (“Wrong Password?”)
DoCmd.Close acForm, Me.NameEnd If
Save the code and exit and also save the changes to the form. Now try to open the form and you will get a password box before the form will open. If you enter the correct password then it will open, otherwise it will not. Another thing I should mention is that the text for the password is not dotted out or starred out like is usually is with password protection forms. I think that this can be changed but that is beyond the scope of this tutorial.
This code is pretty basic. To use this you will need to change the line that says “whatever password you choose here” to whatever you want the password to be. And then change the “name of the form that you want to password protect” to the name of your form. Now, you can change “Enter Password” to whatever message you want to appear when the password box comes up, and likewise, you can change the “Wrong Password?” part to whatever message that you want to display when the user enters the wrong password or does not enter any password at all.
So there you have it, a pretty easy and basic password protection system to password protect a form or report in Microsoft access. This will work with just about any version of Access, so give it a try. Just remember that this is not really completely secure becuase anyone who knows how can just look at the form in design view and then check the ‘onload’ event code to discover the hard-coded password, but the average user will never know how to do this anyway, so this is a reasonably decent solution.
Thanks for reading this tutorial on password protecting a form or report in a microsoft access database.
I real thankful to find this website on bing, just what I was looking for : D too saved to favorites .
We’re a group of volunteers and starting a new scheme in our community. Your site offered us with valuable info to work on. You have done a formidable job and our whole community will be grateful to you.
I like this web site because so much utile stuff on here : D.
I like this blog very much so much excellent information.
Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire actually enjoyed account your blog posts. Anyway I will be subscribing to your augment and even I achievement you access consistently fast.
Hey there, You’ve done a great job. I will definitely digg it and personally recommend to my friends. I’m confident they’ll be benefited from this site.
Hi my loved one! I want to say that this article is awesome, great written and come with almost all important infos. I would like to peer extra posts like this .
We’re a group of volunteers and starting a new scheme in our community. Your site offered us with valuable info to work on. You have done an impressive job and our whole community will be thankful to you.
I am not rattling superb with English but I get hold this rattling easy to read .
There’s noticeably a bundle to know about this. I assume you made certain nice factors in options also.
I always was concerned in this topic and stock still am, thanks for putting up.
The Silent Shard hola amigoThis may probably be really useful for some of your work I intend to will not only with my website but
Some times its a pain in the ass to read what people wrote but this internet site is really user pleasant! .
Glad to be one of several visitors on this awing site : D.
I’d always want to be update on new posts on this internet site , saved to my bookmarks ! .
In the great design of things you get a B- with regard to effort. Where you actually confused everybody was first on the particulars. You know, they say, details make or break the argument.. And it could not be much more true here. Having said that, permit me tell you what did do the job. Your article (parts of it) is definitely pretty engaging which is most likely why I am making an effort to opine. I do not really make it a regular habit of doing that. Next, although I can certainly see the leaps in reason you make, I am definitely not convinced of how you seem to connect your points which produce your final result. For now I will, no doubt subscribe to your issue however wish in the foreseeable future you actually link the facts much better.
I precisely needed to say thanks all over again. I’m not certain the things I might have followed in the absence of those recommendations contributed by you regarding that area of interest. It truly was a real terrifying issue in my position, but being able to see a new expert fashion you treated the issue took me to jump for happiness. Extremely happier for the assistance and even trust you find out what an amazing job you happen to be undertaking training the others thru a site. More than likely you haven’t got to know all of us.
Loving the information on this website , you have done great job on the articles .
I’ve learn a few excellent stuff here. Definitely value bookmarking for revisiting. I wonder how so much effort you place to make this kind of fantastic informative website.
Lovely just what I was looking for.Thanks to the author for taking his time on this one.
I truly enjoy looking at on this website , it has good blog posts.
I envy your piece of work, thankyou for all the useful posts .
I enjoy you taking the time to create this publish. It is extremely useful to me in fact. Enjoy it.
I genuinely have studying by this website, it has got fantastic posts. “And all the winds go sighing, In support of sweet equipment dying.” by Christina Georgina Rossetti.
Really informative and excellent anatomical structure of subject material , now that’s user genial (:.
I don’t ordinarily comment but I gotta state regards for the post on this amazing one : D.
In this article I will teach you the basics of how to have fun learning your chords
by playing out of a Fake Book. As an alternative, it will most likely be far more powerful for you to learn about audio and chord idea.
The last type of chords we will discuss in this article are spread voicings.
I am glad that I observed this blog , exactly the right information that I was searching for! .
Very interesting topic , thanks for putting up.
Its superb as your other posts : D, thankyou for posting .
I am impressed with this website , rattling I am a big fan .
Hey there, You’ve done a fantastic job. I’ll certainly digg it and personally suggest to my friends. I’m confident they will be benefited from this website.
Just wanna input on few general things, The website layout is perfect, the content is very wonderful : D.
If you offer to pay for a lot more than what your state allows you to
definitely charge in interest propsper will let you already know payday loans online bu durum da tam bir
felaketti nk hem banka banka kouturmak gerekiyordu, banka grevlilerini eki nakite dndrmeleri iin onlar ikna etmek gerekiyordu,
sonra da bir ay kadar da beklemek gerekiyordu.
Excellent post. I used to be checking continuously this blog and I am inspired! Extremely useful information specifically the closing section 🙂 I maintain such info a lot. I used to be seeking this particular info for a long time. Thank you and good luck.
I love reading and I think this website got some genuinely useful stuff on it! .
Glad to be one of the visitors on this amazing internet site : D.
I like this blog so much, saved to favorites .
I dugg some of you post as I cogitated they were very beneficial handy
I think this is among the most significant info for me. And i am glad reading your article. But should remark on few general things, The site style is perfect, the articles is really nice : D. Good job, cheers
I as well think hence , perfectly composed post! .
If the property from qualified people to ascertain the market from failed financial sector occupiers collides with a steady dividend cashflow from the buyers that check out the creating. It must contain the details of the perils which they cover. In the present scenario, there are a limited liability company you have trouble determining who will hear your appeal, contact the Assessor’s Office generally does not need doing. Chapters 2 and 3, pp.
Zune and iPod: Most people compare the Zune to the Touch, but after seeing how slim and surprisingly small and light it is, I consider it to be a rather unique hybrid that combines qualities of both the Touch and the Nano. It’s very colorful and lovely OLED screen is slightly smaller than the touch screen, but the player itself feels quite a bit smaller and lighter. It weighs about 2/3 as much, and is noticeably smaller in width and height, while being just a hair thicker.
You have observed very interesting points ! ps nice site.
Greetings from Los angeles! I’m bored at work so I decided to check out your site on my iphone during lunch break. I enjoy the info you provide here and can’t wait to take a look when I get home. I’m surprised at how fast your blog loaded on my phone .. I’m not even using WIFI, just 3G .. Anyhow, very good blog!
Some truly howling work on behalf of the owner of this site, dead great content material .
As soon as I found this web site I went on reddit to share some of the love with them.
I like the valuable info you supply on your articles. I will bookmark your weblog and take a look at again right here regularly. I am somewhat certain I’ll learn a lot of new stuff right right here! Best of luck for the following!
Can you please send an e-mail to me the code for this script or please enlighten me in detail concerning this script?
I am impressed with this internet site , very I am a big fan .