473,471 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

password protecting a form

48 New Member
The following code on form_load does ask for a password and opens the desired form if the password is entered correctly. However, if no password or the incorrect password is entered, I get the message box stating the user does not have access to the desired form but then it opens that form anyway.

Please advise,
Jason

Expand|Select|Wrap|Line Numbers
  1. Dim PassWord As String
  2. If PassWord - admin1234" Then
  3. doCmd.openForm "frmAdminMenu"
  4. Else
  5. MsgBox ("Access Denied")
  6. End If
  7. End Sub
  8.  
Mar 15 '13 #1

✓ answered by Seth Schrock

You would need to either put this in the form's OnOpen event so that you can cancel the opening of the form if the password is wrong, or put this in the button that opens the form. Basically what is happening is that you are opening the form and then testing. However, there is nothing to cancel the forms opening so the form will still open.

5 3850
Seth Schrock
2,965 Recognized Expert Specialist
You would need to either put this in the form's OnOpen event so that you can cancel the opening of the form if the password is wrong, or put this in the button that opens the form. Basically what is happening is that you are opening the form and then testing. However, there is nothing to cancel the forms opening so the form will still open.
Mar 15 '13 #2
SeadooRider
48 New Member
Thanks, I put it in the button that opens the form and all works as expected.
Mar 15 '13 #3
Seth Schrock
2,965 Recognized Expert Specialist
Just be aware that if the user has access to all the database objects, they can open the form directly and bypass the password requirement.
Mar 15 '13 #4
SeadooRider
48 New Member
Yes, I plan on locking that down once I'm complete with the build. Which leads me to my next question, is there a way for the user to change the password without going into the code if need be?

thx
Jason
Mar 26 '13 #5
Seth Schrock
2,965 Recognized Expert Specialist
There would be a way to do that (with a few design changes), but since that is a different question than the original, it needs to go in a new thread. We will be glad to help you there.
Mar 26 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: edd | last post by:
Ive seen a few examples of how to password protect my pages by either textfiles / access. But how can I make the pages so that no one can just enter the url and bypass the login page. Im trying...
1
by: M.C. Radhakrishnan | last post by:
Hi, I need to provide a facility to do routine database administration (backups, etc.) without allowing the logged in user to modify the data in any of the SQL server tables. Is there any way...
1
by: Zap | last post by:
Does anyone know how I can password protect XP Professional Control Panel? Thanks Ronnie
3
by: netsurfer | last post by:
hi..I'm working on a project that requires files to be password protected on a UNIX based site. The people that own the web site want to be able to change the password every so often. ...
2
by: Jon Agiato | last post by:
Hello all, I am new to ASP.NET and web development in general so please excuse the simplicity of the question. I want to be able to password protect certain portions on a web site. I am thinking...
8
by: Iain Napier | last post by:
I'm in the middle of developing a website with a downloads section. It's a wad of educational software for an LEA which for obvious reasons needs password protecting. Users have to authenticate...
1
by: Tull Clancey | last post by:
Hi all. I have an app that needs to create a folder off the installation folder, this is not a problem. But, I need to password protect this folder so only the application can get access to the...
3
by: Porkie999 | last post by:
-----------------------------------------------------------------------QUESTION hi i am really stuck with this and its only a small problem. i want to be able to type ......... dsfsjfjsjjfs in...
8
djsjm
by: djsjm | last post by:
Hello again. So I googled myself into finding this code: <?php // Define your username and password $username = "someuser"; $password = "somepassword"; if ($_POST != $username || $_POST...
4
by: student2 | last post by:
Hi. I've placed the following code on the click event of a command button that leads to a form that is password protected:- Private Sub cmdSales_Click() Dim strPasswd strPasswd =...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.