Hello,
I used Microsoft Access to create a login form with
Name
Password
Access Level Admin and User
I would like to let Admin login and open MRB form and User login then open other form like "test"
Please show me how to do it
Thanks in advance
I had code below
Private Sub cmdLogin_Click( )
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEm ployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee. SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPa ssword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword. SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.txtPassword. Value = DLookup("EmpPas sword", "tblAdmins" , "[EmpID]=" & Me.cboEmployee. Value) Then
lngMyEmpID = Me.cboEmployee. Value
'Close logon form and open splash screen
DoCmd.Close acForm, "Logon", acSaveNo
DoCmd.OpenForm "MRB"
DoCmd.Maximize
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword. SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempt s = intLogonAttempt s + 1
If intLogonAttempt s > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator." , vbCritical, "Restricted Access!"
Application.Qui t
End If
End Sub
8 6265 Dököll 2,364
Recognized Expert Top Contributor
Hello,
I used Microsoft Access to create a login form with
Name
Password
Access Level Admin and User
I would like to let Admin login and open MRB form and User login then open other form like "test"
Please show me how to do it
Thanks in advance
I had code below -
-
Private Sub cmdLogin_Click()
-
-
'Check to see if data is entered into the UserName combo box
-
-
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
-
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
-
Me.cboEmployee.SetFocus
-
Exit Sub
-
End If
-
-
'Check to see if data is entered into the password box
-
-
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
-
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
-
Me.txtPassword.SetFocus
-
Exit Sub
-
End If
-
-
'Check value of password in tblEmployees to see if this matches value chosen in combo box
-
-
If Me.txtPassword.Value = DLookup("EmpPassword", "tblAdmins", "[EmpID]=" & Me.cboEmployee.Value) Then
-
-
lngMyEmpID = Me.cboEmployee.Value
-
-
'Close logon form and open splash screen
-
-
DoCmd.Close acForm, "Logon", acSaveNo
-
DoCmd.OpenForm "MRB"
-
DoCmd.Maximize
-
-
Else
-
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
-
Me.txtPassword.SetFocus
-
End If
-
-
'If User Enters incorrect password 3 times database will shutdown
-
-
intLogonAttempts = intLogonAttempts + 1
-
If intLogonAttempts > 3 Then
-
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
-
Application.Quit
-
End If
-
-
End Sub
Hello!
It looks like your code should work. I will attempt to take a stab a it...
On your form
(1) You'll need a command button named cmdLogin
(2) You'll need one textbox named txtPassword
(3) You'll also need a combobox named cboEmployee
In your table, named tblAdmins
(1) You'll need a field named EmpID (links to nothing on form)
(2) You'll need a field named Employee (links to txtPassword on form)
(3) You'll need a field named EmpPassword (links to cboEmployee on form)
Please stay tuned for more, I could have missed something.
Good luck with project:-)
Dököll
Hello!
It looks like your code should work. I will attempt to take a stab a it...
On your form
(1) You'll need a command button named cmdLogin
(2) You'll need one textbox named txtPassword
(3) You'll also need a combobox named cboEmployee
In your table, named tblAdmins
(1) You'll need a field named EmpID (links to nothing on form)
(2) You'll need a field named Employee (links to txtPassword on form)
(3) You'll need a field named EmpPassword (links to cboEmployee on form)
Please stay tuned for more, I could have missed something.
Good luck with project:-)
Dököll
Thank you very much for reply quickly.
My program is working, I would like to enhance it. Let me explain exact what I want to do again.
I would like to modify code above. If Admin login will open MRB form and If User login will open TEST form. That is my idea, I tried some way but did not work. Please give me some help for my project. Thanks again.
Thank you very much for reply quickly.
My program is working, I would like to enhance it. Let me explain exact what I want to do again.
I would like to modify code above. If Admin login will open MRB form and If User login will open TEST form. That is my idea, I tried some way but did not work. Please give me some help for my project. Thanks again.
Hello,
I had code below, and did not know how to make it work with Login code.
Please help. Thanks
Private Sub cmdLogin_Click( )
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEm ployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee. SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPa ssword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword. SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.txtPassword. Value = DLookup("EmpPas sword", "tblAdmins" , "[EmpID]=" & Me.cboEmployee. Value) Then
lngMyEmpID = Me.cboEmployee. Value
End If
'Open correct form
Dim strAccessLevel As String
strAccessLevel = DLookup("[Access]", "tblAdmins" , "[EmpID]=" & Me.cboEmployee. Value)
If strAccessLevel = "Admin" Then
DoCmd.OpenForm "MRB"
Else
If strAccessLevel = "User" Then
DoCmd.OpenForm "TEST"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword. SetFocus
Exit Sub
End If
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempt s = intLogonAttempt s + 1
If intLogonAttempt s > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator." , vbCritical, "Restricted Access!"
Application.Qui t
End If
End Sub
Dököll 2,364
Recognized Expert Top Contributor
Hello,
I had code below, and did not know how to make it work with Login code.
Please help. Thanks -
Private Sub cmdLogin_Click()
-
'Check to see if data is entered into the UserName combo box
-
-
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
-
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
-
Me.cboEmployee.SetFocus
-
Exit Sub
-
End If
-
-
'Check to see if data is entered into the password box
-
-
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
-
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
-
Me.txtPassword.SetFocus
-
Exit Sub
-
End If
-
-
'Check value of password in tblEmployees to see if this matches value chosen in combo box
-
-
If Me.txtPassword.Value = DLookup("EmpPassword", "tblAdmins", "[EmpID]=" & Me.cboEmployee.Value) Then
-
-
lngMyEmpID = Me.cboEmployee.Value
-
End If
-
-
-
'Open correct form
-
Dim strAccessLevel As String
-
-
strAccessLevel = DLookup("[Access]", "tblAdmins", "[EmpID]=" & Me.cboEmployee.Value)
-
-
If strAccessLevel = "Admin" Then
-
DoCmd.OpenForm "MRB"
-
Else
-
If strAccessLevel = "User" Then
-
DoCmd.OpenForm "TEST"
-
Else
-
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
-
Me.txtPassword.SetFocus
-
Exit Sub
-
End If
-
End If
-
-
'If User Enters incorrect password 3 times database will shutdown
-
-
intLogonAttempts = intLogonAttempts + 1
-
If intLogonAttempts > 3 Then
-
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
-
Application.Quit
-
End If
-
End Sub
Greetings and salutations Mai Le!
Hope your week-end plans are in order...
I added some code tags for ya for readibility. Loooks like I switched some things around on you, Mai Le:
(1) You'll need a field named EmpID (links to nothing on form)
(2) You'll need a field named EmpPassword (links to txtPassword on form)
(3) You'll need a field named Employee (links to cboEmployee on form)
Did you try this option? Works on my machine:-) I should perhaps mention I did figure out that EmpID is linked to the form's lngMyEmpID field if that helps...
Do you have a table with the fields mentioned. Tell us and we shall continue, no problem.
In a bit!
Dököll
Greetings and salutations Mai Le!
Hope your week-end plans are in order...
I added some code tags for ya for readibility. Loooks like I switched some things around on you, Mai Le:
(1) You'll need a field named EmpID (links to nothing on form)
(2) You'll need a field named EmpPassword (links to txtPassword on form)
(3) You'll need a field named Employee (links to cboEmployee on form)
Did you try this option? Works on my machine:-) I should perhaps mention I did figure out that EmpID is linked to the form's lngMyEmpID field if that helps...
Do you have a table with the fields mentioned. Tell us and we shall continue, no problem.
In a bit!
Dököll
Thanks for your support.
The code is working but somehow put any password in then can open form. another is password stays in password.
Please help again.
Thanks
Have a nice weekend.
Mai Le,
I have already warned you once to not double post. I see that this is the first thread you posted about this exact same question. Here is a link to the duplicate posting.
Double posting consumes resources and causes confusion. If it happens again it will result in a temporary ban of 1 week.
MODERATOR
Mai Le,
I have already warned you once to not double post. I see that this is the first thread you posted about this exact same question. Here is a link to the duplicate posting.
Double posting consumes resources and causes confusion. If it happens again it will result in a temporary ban of 1 week.
MODERATOR
Hi Scott,
Sorry for confusing, I'm still new in this forum. I tried to learn and understand in urgent. Please ignore this post and delete it if needed. Thanks for your help. You are greatly help. Your code is working in my program. Thank you very much!!
That took me a week to think and figure out how it work. I took your code and applied to my program. It's wonderful.
Mai Le
No problem, Mai Le I understand that things can be confusing.
Glad the code is working for you!
Good luck on the rest of your application.
Regards,
Scott
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Wayne Smith |
last post by:
Applies to: Microsoft FrontPage 2000, Microsoft Access 2000, IIS 5.0
Operating System: Microsoft Windows 2000 Professional
I am trying to protect a portion of a web site by allowing users to register a username and password & then login with those details, but so far I am having only marginal success. I am far from an expert on ASP programming, indeed the code I am using comes from "Sams Teach Yourself E-Commerce Programming with ASP" but it...
|
by: Phillip Armitage |
last post by:
I've spent the better part of two days checking out PHP, javascript and
numerous other language sites trying to find what I figure should be be an
easy web script page. Essentially what I want is a self calling script (ASP,
PHP, whatever) which will do the following:
Let's assume that my script is called FTP.ASP
1) Display an HTML login form prompting user to enter a user name and
password. Login button action (either at the button or...
|
by: william cline |
last post by:
Hi, I am a beginner and below I have code for a long in form. My goal is
for the form to read a file of a list of users and thier passwords
....compare the text box inputs to the file and either start over or load the
main file.... I attempted to use a slect case..but its not working for me..
If someone has a better way of doing it..I would apperciate the help. Thank
you!
Option Explicit
Public LoginSucceeded As Boolean
|
by: Cemal Karademir |
last post by:
Hi,
I'm workin on a small Login page/program with asp.net. It uses an MS-Access
database that looks like this:
USERID | NAME | PASSWORD
_________________________________
1 | John | hello
2 | Paul | hello2
I don't understand why it doesn't work. I think i'm doing something wrong
|
by: dana lees |
last post by:
Hello,
I am developing a C# asp.net application.
I am using the authentication and authorization mechanism, which its timeout
is set to 60 minutes.
My application consists of 2 frames - a header frame and a main frame.
When i enter the application, i see the login screen on the whole screen,
but when the authentication expires, the login screen appears on both
frames.
| |
by: jsd219 |
last post by:
I have a fairly simple login in script and I need to make it have two
levels of access not one. can anyone help me with this? The script is
below:
<?php
// we must never forget to start the session
session_start();
$errorMessage = '';
if (isset($_POST) && isset($_POST)) {
include 'config.php';
|
by: Jennifer.Berube |
last post by:
okay...so I got this login script and I edited it all and it seems to
run fine...IE it listens to the script as far as permissions go when I
place a restriction on a page and when you login it redirects. But
first it doesn't tell you that you're logged in and doesn't provide a
logout feature.
And most importantly if I type in a random username and password not
listed in the database it doesn't seem to matter it still "lets me
login"
|
by: stumo |
last post by:
Hi
I'm fairly new to access and as such my experience of VBA is somewhat limited. I have a login form which is linked to an "employees table" which asks for users to enter their name and password. The current VBA performs all the relevant checks around user name & password etc with no problems. However based on the users access level (which is set in the field "strAccess" in the Enployees table) when I click the "Login" button I'd like to...
|
by: satishknight |
last post by:
Hi,
Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it has to tell then them its wrong information but currently it takes then to a next page and then tells them its incorrect information. This is tedious as every time they enter wrong they will be redirected to a different page and then they have to...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |