473,809 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ 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.txtUs er) Or Me.txtUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtUser.SetF ocus
Exit Sub
End If

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

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

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

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

DoCmd.Close acForm, "frmLogin", acSaveNo
'DoCmd.OpenForm "frmSplash_Scre en"

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

'intLogonAttemp ts = intLogonAttempt s + 1
'If intLogonAttempt s 3 Then
'MsgBox "You do not have access to this database.Please contact
admin.", _
'vbCritical, "Restricted Access!"
'Application.Qu it
'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.Valu e = DLookup("passwo rd", "tblLogin", "[loginID] =" &
Me.txtUser.Valu e) Then
Please send your help via my email at ph*******@yahoo .com.au .Thanks all

Nov 22 '06 #1
6 2339
If Me.txtPass.Valu e = DLookup("passwo rd", "tblLogin", "[loginID] =" &
Me.txtUser.Valu e)

should be:

If Me.txtPass.Valu e = DLookup("passwo rd", "tblLogin", "[username]='" &
Me.txtUser.Valu e & "'")
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.txtUs er) Or Me.txtUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtUser.SetF ocus
Exit Sub
End If

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

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

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

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

DoCmd.Close acForm, "frmLogin", acSaveNo
'DoCmd.OpenForm "frmSplash_Scre en"

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

'intLogonAttemp ts = intLogonAttempt s + 1
'If intLogonAttempt s 3 Then
'MsgBox "You do not have access to this database.Please contact
admin.", _
'vbCritical, "Restricted Access!"
'Application.Qu it
'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.Valu e = DLookup("passwo rd", "tblLogin", "[loginID] =" &
Me.txtUser.Valu e) 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.Valu e = DLookup("passwo rd", "tblLogin", "[username]='" &
Me.txtUser.Valu e & "'")
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
1923
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 hmv.com or cdwow.com - a website that allows users to view information of albums that are stored in a seperate access database. Ok. My database called 'cdshop.mdb' has 3 tables as follows: 1 - 'tblMusicAlbums' 2 - 'tblMusicTracks'
18
2479
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 need: A system whereby the user only has to register ONCE and he will have automatic entry to ANY page without havinto to RE-LOGIN even if he comes in
5
2074
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 page that displays I have private void LinkButton1_Click(object sender, System.EventArgs e) { bool MyVar = true; Msg.Text = "ReDirecting to Home.aspx"; Response.Redirect("Home.aspx",MyVar); }
10
2729
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 VS, however, when I change to release and put it out on the web it fails giving me the following error message The underlying connection was closed. Could not establish a trust relationship with the remote server.
4
1435
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 userid and password column contain the id and password that I am trying to check. You might wonder why I don’t have only two columns, userid and password. I intend to use this database for several different login pages. For a particular login page,...
2
2914
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 users). If user is from intranet, web server should recognize it and application should create additional options in controls regarding groups the user belongs to. If user is from extranet it should be logged in as anonymous and a link to login page...
6
5002
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 for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
6
3365
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 the past in other places, and while the help was much appreciated, it seemed everyone just wanted to 'theoretically' explain how to do it, but when I tried to do it myself, I couldn't login. I want to simply pass the email address and password to...
9
2353
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 have access to a completely different set of pages. "Client" pages are in the root folder and "Admin" and "Trainer" pages each have their own subfolders. The problem is that when a user goes to the domain, I want to redirect "Admin" and...
0
9600
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10375
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,...
0
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
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, 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...
1
7651
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
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();...
0
5548
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...
2
3860
muto222
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.