hi i make a simple loginform in my data base but i cant work it out.. here is the details in my login form
table name: login
consist of the following:
Field1: ID
Field2: Username
Field3: Password
and i make a login form
combobox dropdown menu only username shows
Textbox for password input
and a command button for Login..
here is the code behind the button login
but when i click the login button after i put the username and password a error and im being redirect to VB code...Private Sub Command3_Click() 'Check to see if data is entered into the UserName combo box If IsNull(Me.login) Or Me.login = "" Then MsgBox "You must enter a User Name.", vbOKOnly, "Required Data" Me.login.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 username to see if this 'matches value chosen in combo box If Me.txtPassword.Value = DLookup("password", "username", _ "[ID]=" & Me.login.Value) Then lngMyEmpID = Me.login.Value 'Close logon form and open splash screen DoCmd.Close acForm, "frmLogon", 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
any help will be appreciated..... thank you in advance...
Last edited by phatus; 11-06-2010 at 11:53 PM.
To begin with, you have control names in your code that don't exist on yur form. ie. On your form you have a control called Password, yet in your code you use txtPassword. You need to make sure that you are consistent with your naming conventions. Check all of your code and make sure that your controls that you are naming in the code are the same. It will never work if they are different.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
what i did is import the login form to my database and in splashscreen i create a button that will direct to my form ^ ^...
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Regardless of where you get your form, import or build, you need to make sure that the code that operates the form is consistently named.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
i understand thanks alan... now im done with my data base...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks