473,396 Members | 1,775 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,396 software developers and data experts.

Restrict multiple logins with single username at sametime in ms access

20
Hi all

I have a mdb with login name and password form. There are several login names, i defined through a table "User_login". Here the problem is at a time a single user is able to login in multible system, which i want to restrict.

here is the code which i i am using for login check.....

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmblogin_Click()
  2.  
  3. Static intlogonattempts As Integer
  4.  
  5. 'Check to see if data is entered into the UserName combo box
  6.  
  7.     If IsNull(Me.cmbname) Or Me.cmbname = "" Then
  8.       MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
  9.         Me.cmbname.SetFocus
  10.         Exit Sub
  11.     End If
  12.  
  13.     'Check to see if data is entered into the password box
  14.  
  15.     If IsNull(Me.cmbpass) Or Me.cmbpass = "" Then
  16.       MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
  17.         Me.cmbpass.SetFocus
  18.         Exit Sub
  19.     End If
  20.  
  21.     'Check value of password in tblEmployees to see if this
  22.     'matches value chosen in combo box
  23.  
  24.  
  25.  
  26.         If Me.cmbpass.Value = DLookup("Password_login", "user_login", "[id]=" & Me.cmbname.Value) Then
  27.  
  28.  
  29.             emp_name = Me.cmbname.Value
  30.  
  31.             intlogonattempts = 0
  32.  
  33.             'Close logon form and open splash screen
  34.  
  35.             cmbname.SetFocus
  36.             Me.Visible = False
  37.             DoCmd.OpenForm "As Laid Backlog Digitization Database"
  38.  
  39.  
  40.         Else
  41.           intlogonattempts = intlogonattempts + 1
  42.  
  43.           If intlogonattempts > 3 Then
  44.             MsgBox "Sorry! You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
  45.             Application.Quit
  46.  
  47.          End If
  48.  
  49.           MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
  50.           Me.cmbpass.SetFocus
  51.  
  52.           End If          
  53. End Sub
  54.  

can anyone please help on this..........


Regards
yuvan

<E-mail address removed>
Oct 7 '08 #1
17 4750
NeoPa
32,556 Expert Mod 16PB
You don't say :
What problem you're having.
What error messages you're getting.
What line the error message is on.
Oct 7 '08 #2
NeoPa
32,556 Expert Mod 16PB
Assuming [cmbName] holds a string value, try changing line #26 of your code to :
Expand|Select|Wrap|Line Numbers
  1. If Me.cmbPass = DLookup("Password_login", "user_login", "[id]='" & Me.cmbname & "'") Then
Oct 7 '08 #3
NeoPa
32,556 Expert Mod 16PB
To ensure the same user only logs in once at a time, add a field into your [User_Login] table that indicates if the user is currently logged in. You will need to set it to TRUE after a successful login, and test for that too when checking the name and password.

You will also need a facility to reset any or all names in case the system crashes at any point.
Oct 7 '08 #4
yuvang
20
Hi Neopa,

My problem is a person with the login name "A" is able to login into "N" number of systems at a time. i want to restrict that through VB code. Can you please help on this...........
Oct 16 '08 #5
NeoPa
32,556 Expert Mod 16PB
You don't say :
What problem you're having.
What error messages you're getting.
What line the error message is on.
You answer none of my questions. You don't respond to (ignore) the help I've already posted. Now you want me to start again from scratch.

I understand your basic problem. I need you to respond to my posts before I spend any more time on this. Is that too much to ask? It is your question after all.
Oct 16 '08 #6
yuvang
20
Sorry.... I was out of internet facility for one week at the time of your reply. So that i couldn't able to response to you in right time................
Oct 17 '08 #7
NeoPa
32,556 Expert Mod 16PB
Timing is not a problem, but when you do reply, I still need you to answer the questions. Without all those answers I am unable to help further.
Oct 17 '08 #8
yuvang
20
What problem you're having.
Problem that is a person is able to login in several systems by using same login. That I want to restrict..........
What error messages you're getting.
No error messages.
What line the error message is on
All the lines are working fine. I gave th code just for your reference.
Oct 17 '08 #9
NeoPa
32,556 Expert Mod 16PB
Thank you. Now we can progress.

The next question then (in response to the information) is what did you think about post #4. It seems to me this may well be a solution to the problem you've described.
Oct 17 '08 #10
yuvang
20
i too thing that will work. But i don't know how to do that..........
Oct 17 '08 #11
NeoPa
32,556 Expert Mod 16PB
OK Let's take this step by step.

Do you have a table of accounts that can be used to log on? What is its name?
Oct 17 '08 #12
yuvang
20
Table name is "user_login"
Oct 18 '08 #13
NeoPa
32,556 Expert Mod 16PB
Sorry, that info was already available from the OP (Original Post). Never mind.

The next question is :
What are the names of all the fields you have in that table now?

This will work much better if you can post the meta-data (info about the layout / structure) of the table in the same way as I use in my example. Click on the Reply button and you will have access to all the codes I've used. PK & FK stand for Primary Key & Foreign Key respectively. Never use TABs in this as the layout gets mucked up. Use spaces and all is fine.
Table Name=[User_Login]
Expand|Select|Wrap|Line Numbers
  1. Field           Type      IndexInfo
  2. UserID          AutoNumber    PK
  3. Account         String      Unique
  4. Password        String
  5. FullName        String
  6. InUse           Boolean
This example is a basic layout and includes the items you will need ([FullName] not ABSOLUTELY necessary). You need to post what you have in your table in this layout.
Oct 19 '08 #14
yuvang
20
Hi

here is my table detail

Table Name=[User_Login]
Expand|Select|Wrap|Line Numbers
  1. Field             Type      IndexInfo
  2. ID                Number        PK
  3. EMP_NAME          String      Unique
  4. Password_Login    String
  5. InUse             Boolean
Oct 20 '08 #15
NeoPa
32,556 Expert Mod 16PB
That looks sensible enough.

Looking at your code in the OP (Original Post) I can't see how you're trying to get this to work. You have a Click event procedure for a ComboBox control (cmbLogin) :S I would have expected a Command Button type control (cmd...).

Can you clarify which controls you have on your form for me please, and how a user logs in.
Oct 20 '08 #16
yuvang
20
Yes, your guess is correct. The command button is named as "cmblogin".
Oct 21 '08 #17
NeoPa
32,556 Expert Mod 16PB
Can you clarify which controls you have on your form for me please, and how a user logs in.
Please answer the questions so that we can continue.
Oct 21 '08 #18

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

Similar topics

14
by: The Plankmeister | last post by:
Hi. I reaslise this is possibly considered off-topic, but I want to pick as many expert brains as possible. Apologies in advance.... I have a form on which I have a username and password box....
3
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to restrict access to certain pages, using the built...
3
by: mgPA | last post by:
Short: How can I limit the number of concurrent logins to Access (2000) DB? Long: I seem to be having the problem discussed in previous postings of having more than 9 or 10 concurrent logins. ...
10
by: Conformix Sales | last post by:
Any thought about how can I stop a user from logging into the application multiple times. I am using forms authentication.
2
by: Sudheer | last post by:
Hi All, We need to restrict multiple users login to the system. If one user is online with one userID, we need to show the message "This user already logs in to the system" to the other user who...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
20
by: Keith G. Murphy | last post by:
I'm trying to get a feel for what most people are doing or consider best practice. Given a mod_perl application talking to a PostgreSQL database on the same host, where different users are...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
10
by: shankhar | last post by:
Hi all, In my project there is a requirement. If a user logged in at a time since he/she logged out others are not allowed to loggin using the same user name. That is to avoid multiple logins...
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:
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
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
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,...

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.