8 Replies - 1199 Views - Last Post: 03 February 2013 - 02:27 PM Rate Topic: -----

#1 dinver21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 19-January 13

Login & Logout Error

Posted 03 February 2013 - 11:30 AM

Private Sub TDatacode_Change()
If TDatacode.Text = "" Then
TName.Text = ""
TGender.Text = ""
TYear.Text = ""
cpcnum.Text = ""
Tin.Text = ""
Tout.Text = ""
TName.Locked = True
TGender.Locked = True
TYear.Locked = True
cpcnum.Locked = True
Tin.Locked = True
Tout.Locked = True

Else

TName.Locked = True
TGender.Locked = True
TYear.Locked = True
cpcnum.Locked = True
Tin.Locked = True
Tout.Locked = True

connect
    SQL = "SELECT Student_Info.St_SName,Student_Info.St_FName,Student_Info.St_MName, Student_Info.St_Gender, Student_Info.St_Year, Student_Info.St_PPhone,Student_Info.St_Pic, Log.St_Login, Log.St_Logout, Log.St_LogID FROM Student_Info INNER JOIN Log ON Student_Info.St_ID = Log.St_ID where Student_Info.St_ID ='" & Trim(TDatacode.Text) & "'"
    Set rs = conn.Execute(SQL, adExecuteNoRecords)
    If rs.EOF = False Then
       TName.Text = rs!St_SName & ", " & rs!St_Fname & " " & rs!St_MName
       TGender.Text = rs!St_Gender
       TYear.Text = "BSCpE " & rs!St_Year
       cpcnum.Text = rs!St_PPhone

       TLog.Text = rs!St_Logid
       If TLog.Text <> "" And rs!St_Login <> "" Then
       Tin.Text = rs!St_Login
       Tout.Text = Labe1.Caption
       SQL = "update Log set St_Logout =  ('" & Tout.Text & "') "
       Set rs = conn.Execute(SQL, adExecuteNoRecords)
       
       ElseIf rs!St_Login = "" Then
       Tin.Text = Labe1.Caption
       SQL = "insert into Log (St_ID,St_Login,St_Logout) Values ('" & TDatacode.Text & "','" & Tin.Text & "','" & Tout.Text & "') "
       Set rs = conn.Execute(SQL, adExecuteNoRecords)
       End If
    End If
connectclose
End If
End Sub




Need Help Guyz.. i made an attendance record system...(sorry for my english)
i want that if my IDCode is "0001" and the others have 0002,0003,.... and so on..
i want that the first tym i put my code(0001) my Login field of my database would have the value of present time(Labe1.caption)...
Ex.
ScanID Login Logout
0001 11:01PM -----
0002 11:04PM -----
0003 11:10PM -----
0002 11:04PM 11:30PM
0001 11:01PM 11:40PM
0003 11:10PM 11:55PM
0001 12:01AM -----
0002 12:04AM -----
0003 12:10AM -----
0002 12:04AM 12:30AM
0001 12:01AM 12:40AM
0003 12:10AM 12:55AM

just like that... tnx 4 your concern Guyz and please help me
first tym in vb here..

*** Edit ***
Please use code tags when posting code
:code:

This post has been edited by GunnerInc: 03 February 2013 - 11:39 AM
Reason for edit:: Added elusive code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Login & Logout Error

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

Re: Login & Logout Error

Posted 03 February 2013 - 11:52 AM

Does your code not work? If not, what errors do you receive and what line numbers does it refer to? Or what does it not do that you are expecting it to?

Also, you refer to IDCode and ScanID, etc., but these values don't appear in your code. In your description(s) you should refer to the field-names exactly so we know what you are referring to.

BTW Is 0001 stored as a string or a number? If it is a number then the leading zeroes will disappear when you read them from the database.

This post has been edited by andrewsw: 03 February 2013 - 11:54 AM

Was This Post Helpful? 0
  • +
  • -

#3 dinver21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 19-January 13

Re: Login & Logout Error

Posted 03 February 2013 - 12:02 PM

sorry Sir Andrewsw id got mistaken..
St_ID is a Text Datatype..
it runs.. it works... i had a problem n my Login & Logout Fields..
what i mean is i want that..

St_ID St_Login St_Logout
0001 11:01PM -----
0002 11:04PM -----
0003 11:10PM -----
0002 11:04PM 11:30PM
0001 11:01PM 11:40PM
0003 11:10PM 11:55PM
0001 12:01AM -----
0002 12:04AM -----
0003 12:10AM -----
0002 12:04AM 12:30AM
0001 12:01AM 12:40AM
0003 12:10AM 12:55AM

just like that..
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

Re: Login & Logout Error

Posted 03 February 2013 - 12:11 PM

View Postdinver21, on 03 February 2013 - 12:02 PM, said:

sorry Sir Andrewsw id got mistaken..
St_ID is a Text Datatype..
it runs.. it works... i had a problem n my Login & Logout Fields..
what i mean is i want that..

St_ID St_Login St_Logout
0001 11:01PM -----
0002 11:04PM -----
0003 11:10PM -----
0002 11:04PM 11:30PM
0001 11:01PM 11:40PM
0003 11:10PM 11:55PM
0001 12:01AM -----
0002 12:04AM -----
0003 12:10AM -----
0002 12:04AM 12:30AM
0001 12:01AM 12:40AM
0003 12:10AM 12:55AM

just like that..

Is this the data that is retrieved by your first SQL statement?
If so, where are you going to output this table of data?
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8363
  • View blog
  • Posts: 31,052
  • Joined: 12-June 08

Re: Login & Logout Error

Posted 03 February 2013 - 12:14 PM

... is this VB6 or VB.NET?
Was This Post Helpful? 0
  • +
  • -

#6 dinver21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 19-January 13

Re: Login & Logout Error

Posted 03 February 2013 - 12:22 PM

ElseIf rs!St_Login = "" Or Tin.Text = "" Then
Tin.Text = Labe1.Caption
SQL = "insert into Log (St_ID,St_Login,St_Logout) Values ('" & TDatacode.Text & "','" & Tin.Text & "','" & Tout.Text & "') "
Set rs = conn.Execute(SQL, adExecuteNoRecords)
End If
ive got mistaken again.. thats the exact code..

this is wat i mean.. it only puts data on my St_Login Field.. while my St_Logout = Nothing..
St_ID St_Login St_Logout
0001 11:53:58 PM
0002 11:54:03 PM
0001 11:54:07 PM
0001 11:54:11 PM
Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

Re: Login & Logout Error

Posted 03 February 2013 - 12:28 PM

View Postmodi123_1, on 03 February 2013 - 12:14 PM, said:

... is this VB6 or VB.NET?

Label1.Caption suggests VB6.

View Postdinver21, on 03 February 2013 - 12:22 PM, said:

ElseIf rs!St_Login = "" Or Tin.Text = "" Then
Tin.Text = Labe1.Caption
SQL = "insert into Log (St_ID,St_Login,St_Logout) Values ('" & TDatacode.Text & "','" & Tin.Text & "','" & Tout.Text & "') "
Set rs = conn.Execute(SQL, adExecuteNoRecords)
End If
ive got mistaken again.. thats the exact code..

this is wat i mean.. it only puts data on my St_Login Field.. while my St_Logout = Nothing..
St_ID St_Login St_Logout
0001 11:53:58 PM
0002 11:54:03 PM
0001 11:54:07 PM
0001 11:54:11 PM

If I understand then this means that Tout.Text is empty when you insert it into the database. Use a MsgBox to see what Tout.Text contains, just before you insert it into the database.
Was This Post Helpful? 0
  • +
  • -

#8 dinver21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 19-January 13

Re: Login & Logout Error

Posted 03 February 2013 - 12:28 PM

i named it Labe1..
thats whyi coded Labe1.caption
thats where my Current Time displayed..
Was This Post Helpful? 0
  • +
  • -

#9 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2216
  • View blog
  • Posts: 9,351
  • Joined: 29-May 08

Re: Login & Logout Error

Posted 03 February 2013 - 02:27 PM

It's vb6.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1