How to Password Protect a Form or Report in Microsoft Access

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.

959 thoughts on “How to Password Protect a Form or Report in Microsoft Access”

  1. Hello, its understandable piece of writing along with this YouTube video; I can’t think that one can not understand this straightforward paragraph having with video demonstration.

  2. Because the YouTube video tutorials are posted at this place same like I also embed YouTube video code at my own site, for the reason that it is straightforward to obtain embedded code.

  3. You actually make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I am looking forward for your next post, I will try to get the hang of it!

  4. It cost 30 less, you get a foothold in your new career field if you pass your exams and otherwise qualify for your gun, buy one and try spot welding again. SETTINGS How to adjust your gas: If you have an idea for something new and exciting, put the word out to people, and see how business is. {||||

  5. I’m now not certain the place you are getting your info, but great topic. I needs to spend some time learning more or figuring out more. Thank you for magnificent information I was on the lookout for this information for my mission.

  6. Hello my loved one! I wish to say that this post is amazing, nice written and include almost all important infos. I would like to peer extra posts like this .

  7. certainly like your web site however you need to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling problems and I in finding it very troublesome to inform the truth nevertheless I will surely come back again.

  8. While most singapore loans instead of getting a loan. Or outstanding credit rating. So as you are seeking a loan?,” when with friends or loved ones, and they have wiggled their way through the lender. Though these loans in the strictest sense, a requirement.Individuals with bad credit instant approval.

  9. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a bit, but instead of that, this is great blog. A great read. I will certainly be back.

  10. I am really inspired along with your writing skills as well as with the format for your blog. Is that this a paid theme or did you customize it your self? Anyway stay up the excellent quality writing, it is rare to look a nice weblog like this one nowadays..

  11. A basic page, with demure colors and mind the possible lack of fireworks from this to feel the pleasure if reading items. As you can view on a side you’re able to do something uncomplicated and all at once very relaxing!

  12. You are actually a excellent webmaster. The website loading pace is amazing. It seems that you’re doing any distinctive trick. Also, The contents are masterpiece. you have performed a wonderful activity on this subject!

  13. You have to waste less time to search your required matter on world-wide-web, because nowadays the searching methods of search engines are fastidious. That’s why I fount this paragraph here.

  14. Pretty section of content. I just stumbled upon your website and in accession capital to assert that I get in fact enjoyed account your blog posts. Any way I will be subscribing to your augment and even I achievement you access consistently fast.

  15. All right, you are correct buddy, daily updating weblog is genuinely essential in support of Search engine optimization. Good discussion keeps it up.

  16. hi!,I love your writing so so much! proportion we communicate more approximately your article on AOL? I require a specialist on this house to solve my problem. May be that’s you! Having a look forward to peer you.

  17. Winteг Park onlіne pokieѕ is home plate to mаny poκie vеnues
    ѕhοuld Aucκlаnd receivе? The Qosmio Х775-3 DV78 toо
    has a highѕсhoοl pеrfoгmance NVIDӏA GeForce you mіghtiness preferaԁding a mousefor bеtteг gameplay.

  18. Wonderful blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thank you

  19. magnificent factors altogether, you just gained a fresh reader. What would you advise in regards to your article which you built several days and nights back? Any good?

  20. Helpful information. Fortunate me I found your website by chance, and I am surprised why this accident didn’t happened in advance! I bookmarked it.

  21. Appreciating the hard work you put into your blog and detailed information you offer. It’s awesome to come across a blog every once in a while that isn’t the same unwanted rehashed material. Great read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  22. Sorry for the huge review, but I’m really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it’s the right choice for you.

  23. I together with my buddies were found to be analyzing the fantastic key points from your internet site while suddenly got a horrible suspicion I had not thanked the blog owner for those secrets. These boys were undoubtedly consequently happy to read through all of them and have in effect extremely been utilizing these points. Appreciate your really being nicely accommodating and then for obtaining such terrific beneficial guides a lot of people are truly wanting to learn about. Our own sincere regret for not saying thanks to you sooner.

  24. You are truly a good webmaster. The site loading velocity is incredible. It sort of feels that you are doing any unique trick. Also, The contents are masterwork. you have done a wonderful process in this subject!

  25. I do like the way you have presented this matter plus it does indeed provide us some fodder for consideration. On the other hand, from what precisely I have witnessed, I simply trust when the remarks pack on that folks remain on issue and not embark on a tirade associated with some other news of the day. Yet, thank you for this superb point and although I do not really go along with this in totality, I value the standpoint.

  26. Wow, excellent website! We declare i always was looking for something completely different, and i also came up here. Properly, it happens. But it wasn’t a great ill-fated shot, I absolutely enjoyed your lifestyle regarding producing! Carry on!

  27. In my house when I get bored, then I simply ON my notebook and open YouTube site to watch the YouTube movies.

  28. You could certainly see your enthusiasm within the paintings you write. The world hopes for even more passionate writers like you who are not afraid to say how they believe. Always go after your heart.

  29. I think this is among the most vital information for me. And i’m glad reading your article. But wanna remark on few general things, The website style is ideal, the articles is really great : D. Good job, cheers

  30. whoah this weblog is magnificent i love studying your posts. Stay up the good work! You know, lots of individuals are hunting around for this info, you could aid them greatly.

  31. Definitely believe that which you said. Your favorite justification appeared to be on the web the simplest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they just don’t know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks

  32. Hello there! I know this is kinda off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one? Thanks a lot!

  33. I just like the valuable info you supply in your articles. I will bookmark your weblog and take a look at once more here regularly. I’m quite certain I will be told lots of new stuff right here! Good luck for the next!

  34. Really programming is nothing however it’s a logic, if you obtain handle on it afterward you are the professional else nothing.

  35. I’ll gear this review to 2 types of people: current Zune owners who are considering an upgrade, and people trying to decide between a Zune and an iPod. (There are other players worth considering out there, like the Sony Walkman X, but I hope this gives you enough info to make an informed decision of the Zune vs players other than the iPod line as well.)

  36. I seldom comment, however I browsed a ton of remarks on this page How to Password Protect a Form or Report in Microsoft Access | Shane Zentz's Blog. I do have some questions for you if it’s okay. Is it only me or does it look like like some of the comments come across like they are written by brain dead visitors? 😛 And, if you are writing at additional online sites, I would like to keep up with you. Would you post a list of every one of your social networking pages like your Facebook page, twitter feed, or linkedin profile?

Comments are closed.