Employee Management
Employee Management
Visual Basic 6 .0
for Employee Record Management in an organization.
The application does following tasks
System Model
E-R Diagram for Employee Record Management
Working with MS Access Database
Accessing Access Database from Visual Basic 6
Creating Module1 for Database Connectivity
Code for frmEMPMANAGE
Components of frmLogin
Code for frmLogin
Components for frmEmpDetails
Code for frmEmpDetails
Component for frmSalary
Code for frmSalary
Components for frmDependent
Code for frmDependent
frmMenu [MDI Form]
Create a New MDI Form
Code for frmMENU
System Model
System Model – Employee Record Management
Em
ployee Table in Design View
Login Table in Design View
Log
in Table in Design View
Note: Each Table should have at least one field as Primary Key.
ADODB Component
Under the Adodc properties windows > Click Build.
Advertisements
ADODC Properties
Connection String
This new Connection String will be used in Module.Bas file for
accessing the database at run-time. The existing ADODC control is no
longer required and you can delete it.
con.Open constr
MsgBox ("connected")
End Sub
Unload Me
frmLogin.Show
End Sub
Components of frmLogin
Form Login
Labels
Name: lblUserID
Caption:UserID
Name: lblPassword
Caption: Password
Textboxes
Name: txtUserID
Text: 'leave blank'
Name: txtPassword
Text; 'leave blank'
Buttons
Name; vbOK
Caption: Login
Name: vbCancel
Caption: Cancel
Code for frmLogin
Option Explicit
Public LoginSucceeded As Boolean
End Sub
Name: lblFirstname
Caption: FirstName
Name: lblLastname
Caption: LastName
Name: lblHRA
Caption: HRA
Name: lblDA
Caption: DA
Name: lblBasic
Caption: Basic
TextBoxes
Name: txtEmpID
Text: 'leave blank'
Name: txtFirstname
Text: 'leave blank'
Name: txtLastname
Text: 'leave blank'
Name: txtHRA
Text: 'leave blank'
Name: txtDA
Text: 'leave blank'
Name: txtBasic
Text: 'leave blank'
Buttons
Name: cmdAdd
Caption: &ADD
Name: cmdDel
Caption: &DELETE
Name: cmdUpdate
Caption: &Update
Name: cmdClr
Caption: &Clear
Name: cmdExit
Caption: &Exit
Name: cmdFirstname
Caption: &FirstName
Name: cmdLastname
Capttion: &LastName
Name: cmdNext
Caption: Next Record
Name: cmdPrev
Caption: Previous Record
Code for frmEmpDetails
Private Sub cmdAdd_Click()
con.Execute "INSERT INTO emp(EmpID,FirstName,
LastName,Basic, HRA, DA)
VALUES (" & txtEmpID & ",'" &
txtFirstname & "','" &
txtLastname & "'," &
txtBasic & "," &
txtHRA & "," &
txtDA & " );"
txtEmpID = ""
txtFirstname = ""
txtLastname = ""
txtBasic = ""
txtHRA = ""
txtDA = ""
End Sub
End Sub
Name: lblEmpID
Caption: ENTER EMPLOYEE ID
Name: lblGrossP
Caption: GROSS PAY
Name: lblNetP
Caption: NET PAY
Textboxes
Name: txtEmpID
Text: 'leave blank'
Name: txtGross
Text: 'leave blank'
Name: txtNet
Text: 'leave blank'
Buttons
Name : cmdGross
Caption: GROSS PAY
Name: cmdNet
Caption: NET PAY
Name: cmdExit
Caption: EXIT
Code for frmSalary
Private Sub cmdExit_Click()
Unload Me
con.Close
End Sub
rs.Close
End Sub
End Sub
Name: lblDname
Caption: Department Name
Name: lblRelation
Caption: Relation
Name: lblDependent
Caption: Employee Dependent
Textboxes
Name: txtDID
Text: 'leave blank'
Name: txtDname
Text: 'leave blank'
Name: txtRel
Text: 'leave blank'
Name: txtEmpID
Text: 'leave blank'
Buttons
Name: cmdAdd
Caption: &ADD
Name: cmdDel
Caption: &DELETE
Name: cmdUpdate
Caption: &UPDATE
Name: cmdClr
Caption: &CLEAR
Caption: &EXIT
Name: cmdExit
Code for frmDependent
Private Sub cmdAdd_Click()
con.Execute "INSERT INTO
Dependent(DependentID, DependentName,Relation,EmpID )
VALUES (" & txtDID & ", '" &
txtDName & "','" &
txtRel & "'," &
txtEmpID & ");"
txtDID.Text = ""
txtDName.Text = ""
txtRel.Text = ""
txtEmpID = ""
End Sub
Caption : Dependents
Name : dependents
Index : 2
Caption : Exit
Name : exit
Index : 3
Code for frmMENU
The code for frmMENU is simple, you click on one of the menu item and
a new form opens up, however the new form does not open in a separate
windows, but it will open within frmMENU as MDI Child form.
Private Sub depend_Click(Index As Integer)
frmDependent.Show
End Sub