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

Home Posts Topics Members FAQ

Help for making a login page via Microsoft Access

I m trying to make a login page via Microsoft access. This is my table
..

Table name : tblLogin
PK : loginID(Auto number)
Attributes : username , password.

I make a login form in Microsoft Access which has 2 textfields name :
txtUser and txtPass with a login button name cmdLog . How can i make
the login button works ( open a form call tblMain) when the righ
username and password from the tblLogin are entered?

I had make my attempt by trying someone's code:

Private Sub cmdLog_Click()
'Check to see if data is entered into the UserName combo box

If IsNull(Me.txtUser) Or Me.txtUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtUser.SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box

If IsNull(Me.txtPass) Or Me.txtPass = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPass.SetFocus
Exit Sub
End If

'Check value of password in tblEmployees to see if this
'matches value chosen in combo box

If Me.txtPass.Value = DLookup("password", "tblLogin", "[loginID]
=" & Me.txtUser.Value) Then
userName = Me.txtUser.Value
'Close logon form and open splash screen

DoCmd.Close acForm, "frmLogin", acSaveNo
'DoCmd.OpenForm "frmSplash_Screen"

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
admin.", _
'vbCritical, "Restricted Access!"
'Application.Quit
'End If
End Sub

But in the end i receive a messege of Run-time error '2001': You
canceled the previous operation. When i debug it, it highlights the
line:

If Me.txtPass.Value = DLookup("password", "tblLogin", "[loginID] =" &
Me.txtUser.Value) Then
Please send your help via my email at ph*******@yahoo.com.au .Thanks all

Nov 22 '06 #1
6 2321
If Me.txtPass.Value = DLookup("password", "tblLogin", "[loginID] =" &
Me.txtUser.Value)

should be:

If Me.txtPass.Value = DLookup("password", "tblLogin", "[username]='" &
Me.txtUser.Value & "'")
The problem was that you were comparing the username that was inputted
to the userid (autonumber).

Cheers,
Jason Lepack
ph*******@gmail.com wrote:
I m trying to make a login page via Microsoft access. This is my table
.

Table name : tblLogin
PK : loginID(Auto number)
Attributes : username , password.

I make a login form in Microsoft Access which has 2 textfields name :
txtUser and txtPass with a login button name cmdLog . How can i make
the login button works ( open a form call tblMain) when the righ
username and password from the tblLogin are entered?

I had make my attempt by trying someone's code:

Private Sub cmdLog_Click()
'Check to see if data is entered into the UserName combo box

If IsNull(Me.txtUser) Or Me.txtUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtUser.SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box

If IsNull(Me.txtPass) Or Me.txtPass = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPass.SetFocus
Exit Sub
End If

'Check value of password in tblEmployees to see if this
'matches value chosen in combo box

If Me.txtPass.Value = DLookup("password", "tblLogin", "[loginID]
=" & Me.txtUser.Value) Then
userName = Me.txtUser.Value
'Close logon form and open splash screen

DoCmd.Close acForm, "frmLogin", acSaveNo
'DoCmd.OpenForm "frmSplash_Screen"

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
admin.", _
'vbCritical, "Restricted Access!"
'Application.Quit
'End If
End Sub

But in the end i receive a messege of Run-time error '2001': You
canceled the previous operation. When i debug it, it highlights the
line:

If Me.txtPass.Value = DLookup("password", "tblLogin", "[loginID] =" &
Me.txtUser.Value) Then
Please send your help via my email at ph*******@yahoo.com.au .Thanks all
Nov 22 '06 #2
I tried your code but the message error is still the same.

Nov 22 '06 #3
I m happy to send any helpers my database file. I m just stuck at the
login button function T.T . The hour of my assignment is drawing near.

Nov 22 '06 #4
If Me.txtPass.Value = DLookup("password", "tblLogin", "[username]='" &
Me.txtUser.Value & "'")
The problem was that you were comparing the username that was inputted
to the userid (autonumber).
Cheers,
Jason Lepack
ph*******@gmail.com wrote:
I m happy to send any helpers my database file. I m just stuck at the
login button function T.T . The hour of my assignment is drawing near.
Nov 22 '06 #5
i have tried, doesnt work :'(

Nov 26 '06 #6
sorry mate, it works now. thanks for all the help. Cheer

Nov 26 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: *** HAWK | last post by:
I previously posted but didnt have much response. I have written out what exactly I am trying to do with my ASP site again but hopefully clearer. I am making a site will emulate something like...
18
by: | last post by:
Please help. After a number of wrong turns and experiments I need advice on login management system to secure our web pages without inconveniencing our visitors or our internal staff. What I...
5
by: PaulThomas | last post by:
Working with XP-Pro and VS.Net I have set my Start Page to "Home.aspx" but the application always starts the "Login" page - - - How can I change the start page to the Home.aspx??? On the login...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
4
by: Joe | last post by:
Hi, I have MS Access database with a small table that has four columns ID (Primary Key), page, userid and password. The page column holds the name of the page which has the login form. The...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
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...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
9
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will...
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,...
1
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...
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,...
1
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...
0
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...
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
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 ...
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.