473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Limit the number of times users can re-enter a password

Hi,

I have designed a database with a multi-user login function. However the code I have used (shown below) does not restrict the number of times users can re-enter a password.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Private Sub Login_Click()
  3. UserName.SetFocus
  4. If UserName = "Staff1" And Password = "Staff1" Then
  5. MsgBox "Welcome"
  6. DoCmd.Close
  7. DoCmd.OpenForm "Staff1"
  8. ElseIf UserName = "Staff2" And Password = "Staff2" Then
  9. MsgBox "Welcome"
  10. DoCmd.Close
  11. DoCmd.OpenForm "Staff2"
  12. ElseIf UserName = "Manager1" And Password = "Manager1" Then
  13. MsgBox "Welcome, please exercise caution when changing query or table conditions", vbInformation, "CDSignatures"
  14. DoCmd.Close
  15. DoCmd.OpenForm "Manager1"
  16. Else
  17. MsgBox "Please re-enter Username and Password"
  18. End If
  19. End Sub
Is there a way of doing this, if so, can the program also be terminated after this sequence and the individual user locked out.
Oct 29 '12 #1
8 1705
zmbd
5,501 Expert Mod 4TB
Several ways of doing this:

If you want to "lock" a user out then you can use a table and record the number of tries and then flag the user account and then docmd to exit.

What I tend to do if I don't want to lock the user out is a do while loop wherein the loop has a counter that increments by one and a boolean flag in an "OR" arrangement. IF the password is valid the flag is true... or the count is exceeded then the flag is false.... true flags run the rest of the code... false flag and the application exits access.

Third way... when I really want to cause user's grief with lockout is to flag their user record... but I also put a flag in the user's roaming profile (our company uses a roaming profile; thus, with the right access one can write a value to the registry that follows the user .... evil laugh!)

One more way...and I've only just read about it so I haven't tried it yet is to cause the workstation to lock; thus, requiring the user to re-enter their workstation password. Haven't read thru the code yet so I don't know how useful it will be in this situation; however, in my company, the IT Dept has set the max bad attempts at 3 and then the user has to call the "Help" desk to reset... and that follows them too!
Oct 30 '12 #2
Sorry, I am very new to access. I am using 2007 what's the loop code that I can use?
Oct 30 '12 #3
TheSmileyCoder
2,322 Expert Mod 2GB
First off we need information from you. Would you like the app to just exit after X attempts? Basicly this means user can just re-open the database and try again.

Or do you want the users account to be locked until re-opened by an admin?

Finally, with security, you need to remember to strengthen the weakest point, not the strongest. There is no need to re-inforce the locked door if the window is left wide open. If the users are still allowed access into the db by holding down shift, then the use of a "3-strikes" policy seems overkill.
Oct 30 '12 #4
I would like to lock users out until admin unlock them.

And your right about the shift key is there a way stopping this from being used?
Oct 30 '12 #5
TheSmileyCoder
2,322 Expert Mod 2GB
Yes and no. The shift Key can be disabled by running a bit of code, but can also be re-enabled by running the same piece of code by someone with experience.


If you want to lock users out, the basic principle would be to have their user record store the number of failed attemps, and check that before letting the user login. On succesfull login you should then reset the counter back to 0.
Oct 30 '12 #6
Is there a code for this, sorry I know I am asking a lot of questions.
Nov 2 '12 #7
TheSmileyCoder
2,322 Expert Mod 2GB
There is no simple code for this, one of the reasons being that you should use encoding of any passwords stored.

I have seen way to many databases implemented in which I could plainly find and view users clear-text password in less then a minute.

I have been considering covering the topic as an article but I feel its requires a bit more effort then I can justify using here, at the moment.
Nov 2 '12 #8
NeoPa
32,556 Expert Mod 16PB
ANewUser:
Is there a code for this, sorry I know I am asking a lot of questions.
As per the site rules, we do not simply write code for those that request it. We help and guide a member through their own learning process. How much we write depends on what we see coming from the member, so basic requests for code are often left hanging.

That said, we're more than happy to help you develop code. As a member, we expect you to be interested in learning the skills rather than simply wanting work done for you.
Nov 2 '12 #9

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

Similar topics

2
by: Ian | last post by:
Using Access 97 I want to distribute my database over a LAN but limit the number of PC's that can use it at the same time. Perhaps limit it to 3 so when the 4th user tries to open it they cant...
6
by: Sal | last post by:
I want to sale my Access 2002 program and charge per number of computers using it on the network.This is front/back end database. How can I limit maximum number of users and change it base on some...
3
by: Rod | last post by:
Today and tomorrow we're demonstrating our ASP.NET application to the external business customers who will be using it (this is what would best be called a B2B application). I've set things up so...
1
by: Smalley | last post by:
Need some help please. Have this code and for some reason it is not working correctly. I am not receiving errors, just the table is not being populated at all. I have created the tbl and the frm...
6
by: krvrk | last post by:
Hi, I am creating a report for which i need to query a table for total number of users and Concurrent users logged in. The table will contain Username(nvarcar,not null),SessionStart...
2
BradHodge
by: BradHodge | last post by:
Reading a post regarding network security on a linked database, I saw this post by PDog on number of users in a network Environment... I am about to put a very small database (2200 kb back-end)...
8
by: Mike P | last post by:
What would be the best way of counting the number of users who are currently logged on to a website? I am making the users login against a database of valid users. Would the best way be to add a...
5
by: Jonathan Wood | last post by:
Greetings, I'm using ASP.NET membership and I'd like to query the number of users in a particular role. I don't want the overhead of returning a dataset and then getting the number of items...
3
juve11
by: juve11 | last post by:
hello, i have a vb application that writes into mysql (some kind of autocomplete). problem is that it writes too many rows and the app at a moment starts to run slowly.so an option that i thaught...
1
by: princemasud | last post by:
Hi, I want to know how many times a object of a database was used by the various users,its something like "hit counter".I am using MSSQL 2000. I just want to find the number of users ,who used that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.