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..... - Private Sub cmblogin_Click()
-
-
Static intlogonattempts As Integer
-
-
'Check to see if data is entered into the UserName combo box
-
-
If IsNull(Me.cmbname) Or Me.cmbname = "" Then
-
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
-
Me.cmbname.SetFocus
-
Exit Sub
-
End If
-
-
'Check to see if data is entered into the password box
-
-
If IsNull(Me.cmbpass) Or Me.cmbpass = "" Then
-
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
-
Me.cmbpass.SetFocus
-
Exit Sub
-
End If
-
-
'Check value of password in tblEmployees to see if this
-
'matches value chosen in combo box
-
-
-
-
If Me.cmbpass.Value = DLookup("Password_login", "user_login", "[id]=" & Me.cmbname.Value) Then
-
-
-
emp_name = Me.cmbname.Value
-
-
intlogonattempts = 0
-
-
'Close logon form and open splash screen
-
-
cmbname.SetFocus
-
Me.Visible = False
-
DoCmd.OpenForm "As Laid Backlog Digitization Database"
-
-
-
Else
-
intlogonattempts = intlogonattempts + 1
-
-
If intlogonattempts > 3 Then
-
MsgBox "Sorry! You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
-
Application.Quit
-
-
End If
-
-
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
-
Me.cmbpass.SetFocus
-
-
End If
-
End Sub
-
can anyone please help on this..........
Regards
yuvan
<E-mail address removed>
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.
NeoPa 32,556
Expert Mod 16PB
Assuming [cmbName] holds a string value, try changing line #26 of your code to : - If Me.cmbPass = DLookup("Password_login", "user_login", "[id]='" & Me.cmbname & "'") Then
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.
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...........
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.
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................
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.
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.
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.
i too thing that will work. But i don't know how to do that..........
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?
Table name is "user_login"
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] - Field Type IndexInfo
-
UserID AutoNumber PK
-
Account String Unique
-
Password String
-
FullName String
-
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.
Hi
here is my table detail Table Name=[User_Login] - Field Type IndexInfo
-
ID Number PK
-
EMP_NAME String Unique
-
Password_Login String
-
InUse Boolean
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.
Yes, your guess is correct. The command button is named as "cmblogin".
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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....
|
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...
|
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. ...
|
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.
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |