Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,374 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,513 people online right now. Registration is fast and FREE... Join Now!




capture time of login..

 
Reply to this topicStart new topic

capture time of login..

antukin_cs
25 Aug, 2008 - 09:36 PM
Post #1

New D.I.C Head
*

Joined: 6 Oct, 2007
Posts: 23


My Contributions
Adodc1.RecordSource = "SELECT * FROM USERS WHERE USERNAME ='" + txtUserName.Text + "'"
Adodc1.Refresh

If (Adodc1.Recordset.EOF = False) Then
If (txtPassword.Text = Adodc1.Recordset.Fields("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If



dats my code..can anybody help me add a code to capture the time a user logins...
User is offlineProfile CardPM
+Quote Post

vivekrane1986
RE: Capture Time Of Login..
25 Aug, 2008 - 09:58 PM
Post #2

New D.I.C Head
*

Joined: 1 Aug, 2008
Posts: 28


My Contributions
QUOTE(antukin_cs @ 25 Aug, 2008 - 10:36 PM) *

Adodc1.RecordSource = "SELECT * FROM USERS WHERE USERNAME ='" + txtUserName.Text + "'"
Adodc1.Refresh

If (Adodc1.Recordset.EOF = False) Then
If (txtPassword.Text = Adodc1.Recordset.Fields("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If



dats my code..can anybody help me add a code to capture the time a user logins...



Well If you just want to display the date and Time when user logs in You can Simply put

msgbox Now()

CODE


Adodc1.RecordSource = "SELECT * FROM USERS WHERE USERNAME ='" + txtUserName.Text + "'"
    Adodc1.Refresh

    If (Adodc1.Recordset.EOF = False) Then
        If (txtPassword.Text = Adodc1.Recordset.Fields("Password")) Then
            msgbox Now()
            MsgBox ("Login Successful")
        Else
            MsgBox ("Login Failure. Incorrect Password")
        End If
    Else
        MsgBox ("Login Failure. Username does not exist.")
    End If



Regards,
Vivs.
User is offlineProfile CardPM
+Quote Post

antukin_cs
RE: Capture Time Of Login..
26 Aug, 2008 - 07:37 PM
Post #3

New D.I.C Head
*

Joined: 6 Oct, 2007
Posts: 23


My Contributions
no i dont want to display the time, i want to save the time into the database (MS Access) and retrieve it later...how can i do it?
User is offlineProfile CardPM
+Quote Post

tope10
RE: Capture Time Of Login..
28 Aug, 2008 - 10:25 PM
Post #4

New D.I.C Head
*

Joined: 25 Jun, 2008
Posts: 22



Thanked: 2 times
My Contributions
QUOTE(antukin_cs @ 26 Aug, 2008 - 08:37 PM) *

no i dont want to display the time, i want to save the time into the database (MS Access) and retrieve it later...how can i do it?

QUOTE


You can add a field in the tblUser, name it as TimeLog and after that, try to update the record in the database.


CODE

Adodc1.RecordSource = "SELECT * FROM USERS WHERE USERNAME ='" + txtUserName.Text + "'"
Adodc1.Refresh

If (Adodc1.Recordset.EOF = False) Then
If (txtPassword.Text = Adodc1.Recordset.Fields("Password")) Then

    Adodc1.Recordset.fields("TimeLog") = Format(Time, "HH:mm:ss am/pm")
    Adodc1.Recordset.Update
    MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If





User is offlineProfile CardPM
+Quote Post

thava
RE: Capture Time Of Login..
1 Sep, 2008 - 04:57 PM
Post #5

D.I.C Regular
Group Icon

Joined: 17 Apr, 2007
Posts: 442



Thanked: 18 times
Dream Kudos: 50
My Contributions
i think check the lock type, and record set type also
because it would affect the update statement
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 09:56AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month