Вы находитесь на странице: 1из 11

LOGIN FORM

This form shows login form. It always asks for username and
password.

MAIN FORM

It shows the main form. It contains different buttons, menus and sub
menu items

New Employee Form

Form for adding new employee. It contains information of the


employee including name, date of birth, rate and numbers of hours per day.

Payroll process

This form automatically generates the salary of the employee for the
given period of time.

DTR

Shows the attendance / daily time record of the employee.

Backup and restore FORM

Use for backing up database

Use for restoring Backed up database.

SOURCE CODE
Private Sub Form_Load()

loadall
End Sub

Private Sub Form_Unload(Cancel As Integer)


'Unload frmaddemp
Unload Me
Me.Visible = False
frm_Main.Show
End Sub

Private Sub Label1_Click()


'frmaddemp.Visible = False
'Unload frmaddemp
Unload Me
Me.Visible = False
frm_Main.Show
End Sub
Public Sub loadall()
Dim iTm As ListItem
cOn

Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset
RS.Open "select * from employee", Cn,
adOpenDynamic, adLockOptimistic
If RS.RecordCount <> 0 Then
lv1.ListItems.Clear
Do While Not RS.EOF

Set iTm = lv1.ListItems.Add(, , RS!ID)


iTm.ListSubItems.Add , , RS!Name
iTm.ListSubItems.Add , , RS!Type
iTm.ListSubItems.Add , , RS!gender
iTm.ListSubItems.Add , , RS!Position
RS.MoveNext
Loop
End If

End Sub

Private Sub Label2_Click()

Unload Me
frmaddemp.Show
End Sub

Private Sub Label3_Click()


If Me.lv1.SelectedItem.Text = "" Then
MsgBox "No record Selected!!!'"
Else
Me.Enabled = False
editemp.empid = Me.lv1.SelectedItem.Text
Set RS = Nothing
cOn
RS.Open "Select * from employee where id = '" &
Me.lv1.SelectedItem & "'", Cn, adOpenDynamic,
adLockOptimistic
If RS.RecordCount <> 0 Then
editemp.txtFName = RS!Name
editemp.cbtype = RS!Type
End If
Me.Hide

frmeditemp.Show
End If
End Sub

Private Sub Label4_Click()


If Me.lblid = "" Then
MsgBox " No Selected record!!!"
Else

Dim a As String
a = MsgBox("Are you sure you want to save this
data?", vbYesNo)
If a = vbYes Then
Set RS = Nothing
cOn
RS.Open "Select * from employee where id = '"
& Me.lblid & "'", Cn, adOpenDynamic,
adLockOptimistic
If RS.RecordCount <> 0 Then
RS.Delete
End If

MsgBox " Record Deleted!!!"


allemp.loadall
End If
End If
End Sub

Private Sub lv1_Click()


Me.lblid = Me.lv1.SelectedItem.Text
End Sub

Private Sub lv1_DblClick()


If Me.lv1.SelectedItem.Text = "" Then
MsgBox "No record Selected!!!'"
Else
Me.Enabled = False
frmeditemp.empid = Me.lv1.SelectedItem.Text
Set RS = Nothing
cOn

RS.Open "Select * from employee where id = '" &


Me.lv1.SelectedItem & "'", Cn, adOpenDynamic,
adLockOptimistic
If RS.RecordCount <> 0 Then
frmeditemp.txtFName = RS!Name
frmeditemp.cbtype = RS!Type
End If
Unload Me
frmeditemp.Show
End If
End Sub

Sub search1()
Dim iTm As ListItem
cOn
Dim RS As ADODB.Recordset

Set RS = New ADODB.Recordset


RS.Open "select * from employee where id like
'%" & Me.txtsearch & "%'", Cn, adOpenDynamic,
adLockOptimistic
If RS.RecordCount <> 0 Then
lv1.ListItems.Clear
Do While Not RS.EOF

Set iTm = lv1.ListItems.Add(, , RS!ID)


iTm.ListSubItems.Add , , RS!Name
iTm.ListSubItems.Add , , RS!Type
RS.MoveNext
Loop
End If
End Sub

Sub search2()
Dim iTm As ListItem
cOn
Dim RS As ADODB.Recordset

Set RS = New ADODB.Recordset


RS.Open "select * from employee where name like
'%" & Me.txtsearch & "%'", Cn, adOpenDynamic,
adLockOptimistic
If RS.RecordCount <> 0 Then
lv1.ListItems.Clear
Do While Not RS.EOF

Set iTm = lv1.ListItems.Add(, , RS!ID)


iTm.ListSubItems.Add , , RS!Name
iTm.ListSubItems.Add , , RS!Type
RS.MoveNext
Loop
End If
End Sub

Вам также может понравиться