Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

problem with Punch in clock Punch out clock

$
0
0
hey
im trying to make a punch clock for the users
so far ive manage to make only the punch in clock
now i cant figure out how to make the punch out clock(this is hard for me)
basicaly this is the code for punch in.
my fields in the DataBase are: EnterID,EnterDate,EnterDay,EnterName,EnterOut,EnterRemarks

Code:

Private Sub BttnIN_Click()
If CmbName.ListIndex = -1 Then
MsgBox "employee name is missing", vbInformation
CmbName.SetFocus
Exit Sub
End If
    If NewRec Then
        Dim NewID As Long
        NewID = NextID("EnterID", "Enterwork")
        Dim strSQL As String
strSQL = "INSERT INTO Enterwork "
strSQL = strSQL & "(EnterID, EnterDate, EnterDay, EnterName, EnterIN) "
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","
strSQL = strSQL & "#" & MyDate(PickDate.Value) & "#,"
strSQL = strSQL & "'" & Txt(1).Text & "',"
strSQL = strSQL & "'" & CmbName.Text & "',"
strSQL = strSQL & "'" & Txt(2).Text & "'"
strSQL = strSQL & ")"
CN.Execute strSQL

        Set Itm = Frmtime.LsVw.ListItems.Add(, , Frmtime.LsVw.ListItems.Count + 1, , "logkey")
        Itm.Tag = NewID
        Itm.SubItems(1) = Replace$(PickDate.Value, ",", ".")
        Itm.SubItems(2) = Replace$(Txt(1).Text, ",", ".")
        Itm.SubItems(3) = Replace$(CmbName.Text, ",", ".")
        Itm.SubItems(4) = Replace$(Txt(2).Text, ",", ".")
        If ChkRepeat.Value Then
          PickDate.Value = Now
          Txt(1).Text = Format(Now, "dddd")
          Txt(2).Text = Format(Now, "HH:MM:SS")
          CmbName.ListIndex = -1
          ChkRepeat.Value = 0
         
            Exit Sub
        End If
    Else
   
        With Frmtime.LsVw.SelectedItem
        strSQL = "UPDATE Time SET "
strSQL = strSQL & "EnterDate = #" & MyDate(PickDate.Value) & "#,"
strSQL = strSQL & "EnterDay = '" & Txt(1).Text & "',"
strSQL = strSQL & "EnterName = '" & CmbName.Text & "',"
strSQL = strSQL & "EnterIN = '" & Txt(2).Text & "'"
strSQL = strSQL & " WHERE EnterID = " & .Tag
CN.Execute strSQL
            PickDate.Value = .SubItems(1)
            Txt(1).Text = .SubItems(2)
            CmbName.AddItem (Trim(.SubItems(3)))
            CmbName.Text = Trim(.SubItems(3))
            Txt(2).Text = .SubItems(4)
        End With
    End If
    Unload Me
End Sub

now i dont know if i can use the same code for punchout and how will it be in the same row in the listview with the same Employee.
i realy need your help guys

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>