VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



codes for daily time records

by bryan ace guanlao (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 26th September 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)

codes for daily time records

Rate codes for daily time records



'use dataobject as connection

Private Sub cmdadd_Click()
With datrecords.Recordset
    .AddNew
    txtname.Enabled = True
    txtin.Enabled = True
    txtout.Enabled = True
    txtabsent.Enabled = True
    txtofficer.Enabled = True
    txtworking.Enabled = True
    txtpayment.Enabled = True
    
    txtdate.Text = Date
    cmdsave.Enabled = True
    cmdcancel.Enabled = True
    cmdadd.Enabled = False
    cmdedit.Enabled = False
    cmdfind.Enabled = False
    cmddel.Enabled = False
    datrecords.Enabled = False
    txtname.SetFocus
End With
End Sub

Private Sub cmdcancel_Click()
With datrecords.Recordset
    .CancelUpdate
    txtname.Enabled = False
    txtin.Enabled = False
    txtout.Enabled = False
    txtsalary.Enabled = False
    txtdate.Text = Date
    txtabsent.Enabled = False
    txtofficer.Enabled = False
    txtwork.Enabled = False
    txtworking.Enabled = False
    txtpayment.Enabled = False
    cmdsave.Enabled = False
    cmdcancel.Enabled = False
    cmdadd.Enabled = True
    cmdedit.Enabled = True
    cmdfind.Enabled = True
    cmddel.Enabled = True
    datrecords.Enabled = -True
End With
End Sub

Private Sub cmddel_Click()
want = MsgBox("Are you Sure you want to Delete this Item", vbQuestion + vbYesNo + vbDefaultButton2, "Daily Time Record")
If want = vbYes Then
    With datrecords.Recordset
        .Delete
        datrecords.Refresh
        MsgBox "Records Deleted!", vbInformation, "DELETE"
    End With
ElseIf vbNo Then
    Exit Sub
End If
End Sub

Private Sub cmdedit_Click()
With datrecords.Recordset
    .Edit
    txtname.Enabled = True
    txtin.Enabled = True
    txtout.Enabled = True
    txtabsent.Enabled = True
    txtofficer.Enabled = True
    txtworking.Enabled = True
    txtpayment.Enabled = True
    txtdate.Text = Date
    cmdsave.Enabled = True
    cmdcancel.Enabled = True
    cmdadd.Enabled = False
    cmdedit.Enabled = False
    cmdfind.Enabled = False
    cmddel.Enabled = False
    datrecords.Enabled = False
    txtname.SetFocus
End With
End Sub

Private Sub cmdfind_Click()
With datrecords.Recordset
    hanap = InputBox("Enter the name of employee", "FIND")
    If hanap = "" Then
        Exit Sub
    End If
    .FindFirst "[employee]= '" & hanap & "'"
    If .NoMatch = True Then
        MsgBox "Find No Match!", vbExclamation, "FIND"
    End If
End With
End Sub

Private Sub cmdsave_Click()
txtwork.Text = txtworking - txtabsent
    txtsalary.Text = txtpayment * txtwork
With datrecords.Recordset
    .Fields![employee] = txtname.Text
    .Fields![time_in] = txtin.Text
    .Fields![time_out] = txtout.Text
    .Fields![salary] = txtsalary.Text
    .Fields![absent] = txtabsent.Text
    .Fields![worked] = txtwork.Text
    .Fields![officer] = txtofficer.Text
    .Fields![Now] = txtdate.Text
    .Fields![working] = txtworking.Text
    .Fields![payment] = txtpayment.Text
    .Update
    datrecords.Refresh
    txtname.Enabled = False
    txtin.Enabled = False
    txtout.Enabled = False
    txtsalary.Enabled = False
    txtdate.Text = Date
    txtabsent.Enabled = False
    txtofficer.Enabled = False
    txtwork.Enabled = False
    txtworking.Enabled = False
    txtpayment.Enabled = False
    cmdsave.Enabled = False
    cmdcancel.Enabled = False
    cmdadd.Enabled = True
    cmdedit.Enabled = True
    cmdfind.Enabled = True
    cmddel.Enabled = True
    datrecords.Enabled = True
End With
End Sub

Private Sub Command1_Click()
Unload Me
choose.Show
End Sub

Private Sub datrecords_Reposition()
datrecords.Caption = "                                " & "              Record  " & datrecords.Recordset.AbsolutePosition + 1 & "   of   " & datrecords.Recordset.RecordCount
End Sub



Download this snippet    Add to My Saved Code

codes for daily time records Comments

No comments have been posted about codes for daily time records. Why not be the first to post a comment about codes for daily time records.

Post your comment

Subject:
Message:
0/1000 characters