PC Review


Reply
Thread Tools Rate Thread

login table and login form

 
 
kennytwk
Guest
Posts: n/a
 
      7th Dec 2006
hi i'm new here

i have a login table with user name and password, and a form that require
a username and password to trigger another form, i have connected my form to
the table, can anyone tell me how do i make my form and table work the way we
log in into this forum?? thanks, i know how to do it in java but i'm new to
vba in access

 
Reply With Quote
 
 
 
 
Damon Heron
Guest
Posts: n/a
 
      7th Dec 2006
If I understand correctly, you want the login form to come up when the db is
opened? Select Tools, Startup, and put the name of the form where it says
Display form/page.

HTH
Damon

"kennytwk" <u30020@uwe> wrote in message news:6a68d8a8b611a@uwe...
> hi i'm new here
>
> i have a login table with user name and password, and a form that require
> a username and password to trigger another form, i have connected my form
> to
> the table, can anyone tell me how do i make my form and table work the way
> we
> log in into this forum?? thanks, i know how to do it in java but i'm new
> to
> vba in access
>



 
Reply With Quote
 
 
 
 
kennytwk via AccessMonster.com
Guest
Posts: n/a
 
      8th Dec 2006
no , i'm to build a login feature to my access application, i need my form
to verify the table and authenticate then user. if valid another form will
prompt out.

--
Message posted via http://www.accessmonster.com

 
Reply With Quote
 
Damon Heron
Guest
Posts: n/a
 
      8th Dec 2006
Explain what you mean by "verify the table"? When you open the form, you
can have a combobox for user name and textbox for password that is stored in
the table. The combobox has a row source tied to the table - "SELECT
tblUser.UserID, tblUser.UserName, tblUser.EncryptedPassword FROM tblUser
ORDER BY tblUser.UserName;"

The form's code is like this:

Private Sub cmdChkPwd_Click() ' this is a command button click event that is
on the form
If Me.txtPwd = Me.cboLogin.Column(2) Then ' textbox for password and
combobox for username
DoCmd.Close acForm, "frmLogon" 'this is the login form
DoCmd.openform "frmSplash" ' this is the form that will open after
successful logon

Else
If ct < 4 Then 'this gives four chances
MsgBox "Password not recognized. Try again!", vbOKOnly, "WineWorks"
ct = ct + 1
Else
DoCmd.Quit
End If
End If
End Sub

In the form's module, you need:
Option Compare Database
Dim ct As Integer ' this is the counter for the number of logon attempts.
***************

This is really light security. If you need more security, then consider
workgroups, or sql server. The above code can be fairly secure if you
disable the bypass key and make an mde file, though.

HTH
Damon


"kennytwk via AccessMonster.com" <u30020@uwe> wrote in message
news:6a6f4aa4c5467@uwe...
> no , i'm to build a login feature to my access application, i need my
> form
> to verify the table and authenticate then user. if valid another form will
> prompt out.
>
> --
> Message posted via http://www.accessmonster.com
>



 
Reply With Quote
 
kennytwk via AccessMonster.com
Guest
Posts: n/a
 
      11th Dec 2006
Thanks, what i mean is i have 2 text box,
the first 1 is for the user to key in the username, the second is for the
password, for normal authentication, it act like the way we log into hotmail
or this forum, i have a table, each records have a username and password, if
the record match to the one that the user key into the text boxs, access is
valid, else invalid access to my system,

i think i get what u mean, i have been going through some books to connect
database with ADO, i will try first on my own, thanks, ur code gave me some
idea though

btw about the may i know what u mean by workgroups? is it some setting in MS
Access?,

i have another authentication process where "many user to one ID and
password", which mean multiple user will be using the same "username and
password" to login to an application at the same time, those user can only
"view" whatever that is available in the application, no updating or editing
priviledge is given to them. is it using the "same module" as the 1 above?
can anyone give me some idea? thanks.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...oding/200612/1

 
Reply With Quote
 
Damon Heron
Guest
Posts: n/a
 
      12th Dec 2006
Type "Workgroups" in Access Help. you'll get lots of information on
security there. It's not for the faint of heart though. Make sure you
thoroughly understand it before implementing it.

Damon

"kennytwk via AccessMonster.com" <u30020@uwe> wrote in message
news:6a9b8956d2a47@uwe...
> Thanks, what i mean is i have 2 text box,
> the first 1 is for the user to key in the username, the second is for the
> password, for normal authentication, it act like the way we log into
> hotmail
> or this forum, i have a table, each records have a username and password,
> if
> the record match to the one that the user key into the text boxs, access
> is
> valid, else invalid access to my system,
>
> i think i get what u mean, i have been going through some books to connect
> database with ADO, i will try first on my own, thanks, ur code gave me
> some
> idea though
>
> btw about the may i know what u mean by workgroups? is it some setting in
> MS
> Access?,
>
> i have another authentication process where "many user to one ID and
> password", which mean multiple user will be using the same "username and
> password" to login to an application at the same time, those user can only
> "view" whatever that is available in the application, no updating or
> editing
> priviledge is given to them. is it using the "same module" as the 1 above?
> can anyone give me some idea? thanks.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...oding/200612/1
>



 
Reply With Quote
 
kennytwk via AccessMonster.com
Guest
Posts: n/a
 
      12th Dec 2006
Hi, can anyone tell me where me where i went wrong?, i'm new to vba, the code
may look terrible to u guys, thanks, i have a table "Login" with 2 field
"Username, Password". Another 2 text box, Text0_Username and Text2_Password.

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

Dim ct As Integer
Dim cmd5 As ADODB.Command
Dim rst1 As ADODB.Recordset
Dim str1 As String
Dim fld1 As ADODB.Field
Dim stDocName As String
Dim stLinkCriteria As String

Set cmd5 = New ADODB.Command
With cmd5
.ActiveConnection = CurrentProject.Connection
.CommandText = "SELECT Username, Password FROM LOGIN"
.CommandType = adCmdText
End With

Set rst1 = cmd5.Execute
Do Until rst1.EOF
str1 = ""
For Each fld1 In rst1.Fields
str1 = str1 & fld1.Value & vbTab
Next fld1
rst1.MoveNext
Loop



If (Text0 = fld1 & Text2 = fld1) Then
stDocName = "Project"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If ct < 4 Then
MsgBox "Password not recognized. Please Try again!", vbOKOnly
ct = ct + 1
Else
DoCmd.Quit
End If
End If

rst1.Close
Set fld1 = Nothing
Set rst1 = Nothing
Set cmd5 = Nothing

Exit_Command5_Click:
Exit Sub


Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...oding/200612/1

 
Reply With Quote
 
Damon Heron
Guest
Posts: n/a
 
      12th Dec 2006
You are making it way too difficult.

First the table -I would have three fields: UserID, UserName, Password.
(UserID is an autonumber as primary key). Password field has an input mask
of "Password". This hides the actual password from prying eyes.
Now the form - why have users type in their name each time? Make the User
textbox a combobox instead, and

set the row source (in Properties) to the following: SELECT Login.UserID,
Login.UserName, Login.Password FROM Login ORDER BY Login.UserName;

Then set the combobox format properties:
ColumnCount to 3,
ColumnWidths to 0";1";0" (this stores the values UserID, name and Password,
but only shows the UserName. So combobox1.column(0) is the UserID,
column(1) is the name, and column(2) is the password.

Finally set the input mask of the textbox to "Password" so what the user
types doesn't show on the screen.

Now the user types in the password in text2, and the command button, when
clicked, checks the textbox against combobox.column(2), and if they match
entry is allowed.
So the command button code is only this: (note that I give them more
descriptive names: your text2 is txtPwd, combobox is cboLogin)

Private Sub Command5_Click() ' left off error check for brevity
If Me.txtPwd = Me.cboLogin.Column(2) Then
curUser = Me.cboLogin.Column(0)
DoCmd.Close acForm, "LogonForm"
DoCmd.openform "Your Project Form"
Else
If ct < 4 Then
MsgBox "Password not recognized. Try again!", vbOKOnly, "My Project"
ct = ct + 1
Else
DoCmd.Quit
End If
End If
End Sub

Note also the the "ct" variable is not is this click event! Assign the
variable at the form level, up where it says "Option Compare Database" - the
reason is if it was inside the click event it would never reach 4 since each
click would re-initialise it to zero.

Damon



"kennytwk via AccessMonster.com" <u30020@uwe> wrote in message
news:6aa1ee3a926fa@uwe...
> Hi, can anyone tell me where me where i went wrong?, i'm new to vba, the
> code
> may look terrible to u guys, thanks, i have a table "Login" with 2 field
> "Username, Password". Another 2 text box, Text0_Username and
> Text2_Password.
>
> Private Sub Command5_Click()
> On Error GoTo Err_Command5_Click
>
> Dim ct As Integer
> Dim cmd5 As ADODB.Command
> Dim rst1 As ADODB.Recordset
> Dim str1 As String
> Dim fld1 As ADODB.Field
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> Set cmd5 = New ADODB.Command
> With cmd5
> .ActiveConnection = CurrentProject.Connection
> .CommandText = "SELECT Username, Password FROM LOGIN"
> .CommandType = adCmdText
> End With
>
> Set rst1 = cmd5.Execute
> Do Until rst1.EOF
> str1 = ""
> For Each fld1 In rst1.Fields
> str1 = str1 & fld1.Value & vbTab
> Next fld1
> rst1.MoveNext
> Loop
>
>
>
> If (Text0 = fld1 & Text2 = fld1) Then
> stDocName = "Project"
> DoCmd.OpenForm stDocName, , , stLinkCriteria
> Else
> If ct < 4 Then
> MsgBox "Password not recognized. Please Try again!", vbOKOnly
> ct = ct + 1
> Else
> DoCmd.Quit
> End If
> End If
>
> rst1.Close
> Set fld1 = Nothing
> Set rst1 = Nothing
> Set cmd5 = Nothing
>
> Exit_Command5_Click:
> Exit Sub
>
>
> Err_Command5_Click:
> MsgBox Err.Description
> Resume Exit_Command5_Click
>
> End Sub
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...oding/200612/1
>



 
Reply With Quote
 
kennytwk via AccessMonster.com
Guest
Posts: n/a
 
      13th Dec 2006
yup, thanks for the help, i think i am getting the hang of it,
thanks again

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...oding/200612/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: On login - auto populate a table with users login name Sylvain Lafontaine Microsoft Access ADP SQL Server 0 20th Apr 2008 05:08 PM
Form/Table Problem (form doesn't input info into table) ccraiff@gmail.com Microsoft Access Form Coding 1 25th Mar 2008 09:07 PM
login form to login table kennytwk Microsoft Access Forms 0 7th Dec 2006 04:18 PM
Selecting a record from a form (table) and populate into another form (table) FA Microsoft Access Forms 0 22nd May 2006 04:39 PM
Cannot open database requested in login ''. Login fails. Login failed for user ''. Nevena Microsoft ADO .NET 1 16th Apr 2004 06:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 AM.