Results 1 to 5 of 5

Thread: [RESOLVED] After Update ,Total Hours Only Calculate 2 fields instead of 4 fields why?

Threaded View

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] After Update ,Total Hours Only Calculate 2 fields instead of 4 fields why?

    hey,
    i have a punch clock that users punch in and out
    they can punch in twice and punch out twice
    when i update and try to calculate the total hours
    it updates only 2 fields [EnterIN] [EnterOut]
    instead of [EnterIN] [EnterOut] [EnterIN1] [EnterOut2] why?
    i know that the update is ok i dont get any errors at all
    this is my code
    Code:
    Dim Rs As New ADODB.Recordset
    Rs.Open "Select * From EnterWork where EnterName='" & RplS(CmbName.Text) & "' AND EnterDate = #" & StrDate & "#", CN
    If Not IsNull(Rs!EnterIN1) Then
        StrSql = "UPDATE Enterwork SET "
        StrSql = StrSql & "EnterOut2 = '" & RplS(LblTheTime.Caption) & "',"
        StrSql = StrSql & "EnterRemarks = '" & RplS(TxtRemarks.Text) & "'"
        StrSql = StrSql & " WHERE EnterID = " & Rs!EnterID
        CN.Execute StrSql
         
        Dim TimeDiff As Long
        Dim StartDate As Date
        Dim EndDate As Date
        EndDate = Time
        TimeDiff = DateDiff("n", StartDate, EndDate)
        CN.Execute "Update Enterwork SET [EnterTotal]=DateDiff(""n"", [EnterIn],[EnterOut],[EnterIN1],[EnterOut2]) WHERE [EnterID]= " & Rs!EnterID
            Rs.Close
            Unload Me
            Exit Sub
        End If
        Rs.Close
    tnx for any help
    salsa 31
    Last edited by salsa31; May 17th, 2016 at 09:04 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width