Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 17th, 2005, 03:10 PM
Authorized User
 
Join Date: Sep 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Matthew
Default Creating Login code

I am in a serious trouble right now and I would like seek help from anyone over there.

I want to create a login form that read data from Access Database I developed.
This is my situation:

I have a table called Login included in the database, here I defined three different rows called Username, Password and AceessLevel.

What I want to do is to create a login form bound the table to the form.

What I want to accomplished is this:- when the form starts The username and password will be cleared and the use has to enter their username and password. then the code I am missing will read the information the user entered and compare it with the value in the login table base on the AccessLevel, if the accessLevel is 1 the system opens one menu and if the accesslevel is 2 then the system opens another menu.

Is any one over their has an idea how I will come about this?

Please help

Matthew Ike
Denmark
www.makaiit.net


Matthew Ikechukwu
Email: admin@makaiit.net
__________________
Matthew Ikechukwu
Email: admin@makaiit.net
 
Old November 18th, 2005, 09:04 AM
Authorized User
 
Join Date: Oct 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are going to need a SQL select statement that will cycle through the records. I not sure of the exact code, but i can point you in the right direction.

Code:
Dim rs as recordset

rs = SELECT * FROM TABLE WHERE [table].[username] = [forms]![frmlogin].[username] and [table].[pword] = [forms]![frmlogin].[pword]

'Then try
If Not rs.EOF Then
'Whatever you want to happen with good log in
Else
'Whatever you want to happen with bad log in
End If
Try something along that line. I use something similar on all my ASP login scripts.

 
Old November 24th, 2005, 04:32 AM
Authorized User
 
Join Date: Sep 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Matthew
Default

Please Help!

Can someone help me look at the code displed below? Something is terribly wrong with the code. I am tring to manupulate date through code but I can´t get it work.
On the code below I intend to read a Table value from a table called Login.
I have a logon form not bound to any table,but intended to grab username and password value and compare it with the value in the table Login.

If every thing goes well the select statement will open menu base on the value. You can send me an Email at admin@makaiit.net
Thanks for your help.
--------------------------------here is the code
'Dim MyDB As DAO.Database
'Dim rs As DAO.Recordset
'Dim txtUsername As String
'Dim txtPassword As String
'Dim Departments As String


'Set MyDB = CurrentDb()
'Set rs = MyDB.OpenRecordset("Select * FROM Login", dbOpenSnapShot)


'If Not rs.EOF Then
'txtUsername.SetFocus
'rs("UserName") = txtUsername.Text
'If txtPassword.Visible = True Then
'txtPassword.SetFocus
'rs("Password") = txtPassword.Text
'Select Case Departments

'Case Reception
'txtUsername.SetFocus
'If rs("Username").Value = txtUsername.Text And _
' rs("password").Value = txtPassword.Text Then
'DoCmd.OpenForm "Reception Menu"
'End If
'Case Manager:
'If rs.Fields([UserName]) = txtUsername.Text And _
' rs.Fields([Password]) = txtPassword.Text Then
'DoCmd.OpenForm "administrative Menu"
'End If

'Case Restaurant:
'If rs.Fields([UserName]) = txtUsername.Text And _
' rs.Fields([Password]) = txtPassword.Text Then
'DoCmd.OpenForm "Restaurant Menu"
'End If
'Case Bar:
'If rs.Fields([UserName]) = txtUsername.Text And _
' rs.Fields([Password]) = txtPassword.Text Then
'DoCmd.OpenForm "Bar Menu"
'End If
'Case Else
'If rs.Fields([UserName]) = txtUsername.Text And _
' rs.Fields([Password]) = txtPassword.Text Then
'DoCmd.OpenForm "Bill Menu"

'End If
'End Select

Matthew Ikechukwu
Email: admin@makaiit.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating login form with access database Belzebu Visual Basic 2005 Basics 0 November 8th, 2007 11:33 AM
Creating a login page in PHP bhavna General .NET 0 February 16th, 2007 07:32 AM
Error while creating login page manash.2005 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 January 28th, 2006 07:53 AM
Creating a database login Apocolypse2005 PHP Databases 3 January 6th, 2006 01:59 PM
Creating a Login Form problem malhyp Dreamweaver (all versions) 10 August 20th, 2005 03:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.