ACKNOWLEDGEMENT
We feel proud privilege to extend our sincere thanks to all our well wishers who have affected our project project work and us undoubtedly. undoubtedly. We take take credit for errors. We also take blame for the style which may at times appear to be reflection of our raw, undigested aimless empiricism. Our foremost thanks to our Centre Head Mr. Bhupinderjeet Singh (Project Superviso Supervisor) r) and Mrs. Shikha Sharma Bambah and Mr. N.L. Sony (Project (Project Incharge) and all other teachers of computer department who paved the way for us at every step in the progress of our project.We would also like to very sincerely thank our parents who supported us at every step. Without their guidance and support, this project would not have seen the light of the day .It is the place where we installed our first software and these people provided us that opportunity.
Project Introduction Meaning of Payroll
Payroll means the salary or compensation paid in the exchange of
services rendered by the employees employees of an organization.Payroll organization.Payroll Management Management Syst System em is a syst system em that that mana manage gess the the sala salari ries es of all all empl employ oyee eess in an organization like it adds allowances to salaries, make updation in salaries and make make necess necessary ary deduct deduction ionss from from salary salary and and prepar prepares es the the paysli payslip p of employees till their retirement period comes or they remain in the company.
Payroll Management System
Our project ‘ Payroll Management System’ provides a way to store salary information of employees on monthly basis and gives a view to access these salary records. But before before storing storing salary informati information on of employees employees ,it adds adds info inform rmat atio ion n abou aboutt empl employ oyee eess like like empl employ oyee ee id, id, empl employ oyee ee name name,, desi design gnat atio ion n ,dep ,depart artme ment nt etc. etc.,s ,so o that that thei theirr sala salary ry info inform rmat atio ion n can can be maintained.It provides a way to access the records of current employees as well as the records of those employees who have been left the organization. It also provides a quick way to access the information regarding employees and their salary information. It makes the separation between the records of current employees and the previous employees like if an employee leaves the organization, it deletes its records from the current employee’s records
2
and keeps their separate records. It is capable to perform any changes or updation in the employee information like e-mail id,contact no.,address etc. and to update update the the salary salary infor informat mation ion of employ employees ees like like if an employ employee ee promotes, his salary is changed/updated.It changed/updated.It provides reports to get basic info inform rmat atio ion n rega regard rdin ing g the the curre current nt empl employ oyee eess of an orga organi niza zati tion on like like employee id , employee name, designation ,department, basic salary etc. and to get their payslip information which includes net salary,gross salary etc. It also gives gives a report report to get the payslip information of of single employee. employee.
Security Provided
Our project keeps security in mind,so , only only valid users can can make access access to payro payroll ll manage managemen mentt syste system m and it restri restricts cts unautho unauthorized rized users from accessing the project.It project.It also creates new users and deletes deletes users according according to the requirement. The project uses no. of validations so that only valid data can enter through forms like contact no. field contains only numbers and not text and similarly employee name can contain only text and not numbers.
Brief description of forms in project is as follows:-
used to prov provid idee acce access ss to proj projec ectt ‘Pay ‘Payro roll ll Mana Manage geme ment nt Login:- It is used System’.It also provides the facility to create new users and delete users.
adds the info inform rmat atio ion n of new Add Add Emplo Employe yeee Inform Informati ation: on:-- It add employees in an organization.
3
View Employee Information:- It helps in accessing the information regarding employees.
Add Salary Information:- It adds the salary information of employees on monthly basis.
provid ides es a way way to acce access ss the the sala salary ry View View Salary Salary Informati Information:on:- It prov information of employees.
used to searc earch h or find ind the Search Search Employee Employee Informa Information: tion:-- It is use information regarding a particular employee.
used to mak make any any kind ind of Update Update Employee Employee Informa Information: tion:-- It is use changes in the information of employees.
Delete Employee Information:- It deletes the employee information from the current employees’s information records. r ecords.
Deleted Deleted Records Records Informatio Information:n:- It show showss the the info inform rmat atio ion n of thos thosee employees who have been left the organization.
4
Introduction to Visual Basic Visual basic is a powerful application development tool developed by Micr Micros osof oftt with with the the adve advent nt of the the wind window owss envi environ ronme ment nt.. It is used used for for creating customized windows based programs. Visual Basic is a descendent of BASIC, which was often the first language that programmers used to learn in order to become familiar with programming basics before switching to any other powerful language.
In text based programming, the programmer controls the user interface by encoding instructions but in a visual programming environment, the programmer can quickly design the user interface by drawing and arranging the screen elements. This feature helps the programmer to concentrate on developing the applications functionally rather than spending time on the repetitive programming task. Thus, visual basic is often referred to as a rapid application development (RAD) tool. Visual Visual Basic Basic is not just a language language but it is an integrated integrated developm development ent environment. IDE is basically a term commonly used in programming word to describe the interface and environment where you develop, run, test and debug your applications. applications.
5
COMMON TERMINOLOGY The following are the some of the key terms used in Visual Basic:-
DESIGN TIME: Any time an application is being developed in the
VISUAL BASIC ENVIRONMENT. ENVIRONMENT. RUN TIME: Any time an application is running. At run time, the
programmer interacts with the application application as the user would. would. CONTROLS: Graphical representation of objects, such as button, list
boxes and edit boxes that are used by the user to provide information to the application. PROPERTIES: Are the characteristics of an object such as size, caption
or color. FORMS: Customizable windows that serve as the interface for an
application or as dialog boxes used together information from the user. EVENT: Actions recognized by a form or control. Events occur as the
user user,, oper operat atin ing g syst system em,, or appl applic icat atio ion n inte intera ract ctss with with the the obje object ctss of a program. EVENT DRIVEN PROGRAMMING: When a program is event-driven,
its code is executed in response to events invoked by the user, operating system or application. This differs from procedural programming, where the program starts at the first line code and follows a defined pathway, calling procedures as needed.
6
PROJECT: A Visual Basic is composed of one or more components that
are arranged under a project. The project is stored as a file with a .vbp extension.
OBJECTS: A general term used to describe all the forms and controls that make up a program.
Visual Basic’s integrated development environment
One One of the the most most sign signif ific ican antt feat feature uress of Visua isuall Basi Basicc is the the Inte Integr grat ated ed Develo Developme pment nt Enviro Environme nment nt (IDE). (IDE). IDE is a term term common commonly ly used used in the the programming world to describe the interface and environment that me use to create me applications. It is called Integrated because we can access virtually all all of the the deve develo lopm pmen entt tool toolss that that me need need from from one one scre screen en call called ed an interface. The IDE is also commonly referred to as the design environment, or the program. Visual Basic IDE is made up of a number of components. These components are listed below:•
Menu Bar
•
Tool Bar
•
Project Explorer
•
Properties Window
•
Form Layout Window
•
Toolbox
•
Form Designer
•
Object Browser
7
Tool box Toolbox contains all the objects and controls, which you will add to the form to create the user interface for the project. Controls like command button,
8
text text box, box, rad radio butt button on,, chec check k boxes oxes are are obje object ctss prov provid ided ed by cont contro roll
components, also known as OCX files.
Form designer Windows contains a form on which the controls and objects are going to be placed. Application Application can have more than one one form.
9
Project explorer window
Project Explorer Window shows all files you have used in your application (the collection of files makes a project).
Form layout
Window allows you to visually position the form at design time. All forms that are visible in the environment are displayed. You can position the form to the location where you want it to appear at run time.
Code editor
When you double click click on the form, form, the code editor window window for each form in the application. Any code you need to attach to the form or any control on
10
the form you need to type it in the code editor window. A code window has dropdown list boxes at the top. The list box on the left side displays a list of objects placed on the form. The list box on the right side displays all the events associated with the objects selected in the left side box.
Property window
Properties Window displays the various characteristics (or properties) of the selected object, each and every form in an application is an object. For Example:- a command button that appears on a form is also an object and all characteristics of an object are called its properties. In properties window you will see a list of properties belonging to an object.
11
Introduction to MS-Access Ms Acces ccesss is a powe powerf rful ul mult multii-us user er DBM DBMS deve develo lope ped d by Micro icroso soft ft Corporatio Corporation. n. It can store store and manipulate manipulate large amount amount of information information and automate repetitive task such as maintaining an inventory and generating invoices.In access,data is organized in the form of table. With in a table, reco record rdss are are arra arrang nged ed acco accord rdin ing g to comm common on refe referen rence ce valu valuee know known n as primary key or key field. The value in the key field differ from every record. Thus help in uniquely identifying a record, a combination of two or more fiel field d can can also also be used used as prim primar ary y key key such such a comb combin inat atio ion n is call called ed a composite key since a value in table can be replicated across other table there should be a way to maintain a relation between two tables this relation is implemented through a concept of foreign key in a table is a field which link linkss that that tabl tables es to anot anothe herr tabl tablee data databa base se in acce access ss hav have a defa defaul ultt extension extension .mdb access access also maintain maintain index index file for tables tables and index is an internal table of values that access maintain to store the order of record index objects thus provide efficient access to data. Database indexes works just like book indexes. indexes.
Why we select MS Access Access is multi-user DBMS that can be used by both beginners those who have experience we selected MS- Access as backend since it has major advantages over it predecessor. 12
Window based application Access is window based application and therefore has interface similar to window NT. We can cut, copy and paste any data from any window application to and from MS- Access.
Importing, exporting &linking files Access Access let’s you import and export FoxPro, excel, oracle and other other data format. Importing creates an access table. Exporting an access table create a file in the the format that you are are exporting too. too. Linking means you you can use external data without cresting an access table.
Wizard and builders A wizard is a utility that help to you perform complex task by guiding you through the process. Wizard ask you question about the content style and format of the object you want to create such as a record data entry screen and then generate the object automatically access contains the nearly hundred wizard to design a database application, tables, form and reports.
Built in Function Access include small program known as function that perform simple calculations or data formatting. Access includes mathematical dates, time
13
and string function you can use then to create an expression in your form report.
Macros Macros let you perform common task without user intervention macros let you you mani manipu pula late te data data open open from from repo report rt and and auto automa mate te any any thin thing g that that is complex.
Components of MS-Access Forms Forms : Forms display the data from a table or query in the firmed request
by user . The records or fields in the table are placed in the forms can be edited according to the requirement . For example , user can create a from having roll no name and class of a student ignoring the other fields in the student table .
Queries:
A queries is a question asked by the user to extract information
according to his / her requirement. For a query can be created that asks for the list of students we have secured more then 70%or asks for the list of student detail of indian indian resident in u.s.a . The result of a query is displaced displaced in the forms of data sheet . A query is thus a set of information that changes with the contents of the supporting table .
14
Reports:
Repo Report rtss disp displa laye yed d the the data data in a pres prescr crib ibed ed forma format. t. Acce Access ss
produces the reports by incorporating graphs, chats and different styles. It can be used to group data show subtotal and gland totals. Access enables according to need.
Macros :
Macros are used to automate used tasks access macros execute
numb number er of acti action onss such such as open openin ing g file file , disp displa layi ying ng mess messag agee boxe boxess , validating of data .
Start Access To start Access, double click on the MS-Access icon found in the Microsoft Office. After this, starting screen of MS-Access appears on computer screen.
Creating database
1 Choose new database from the file menu in the acc opening screen . A
window is the access displayed which asks for the name of the new database and the location where a file is to be stored. E.g, here a database created to stored student details 2
Type files name as student .mdb
3 Click the database. 4 Now the window will be displayed on screen known as database window
the windo windows ws provid provides es access access to creat createe table tables, s, querie queriess forms, forms, report reports, s, macros and modulus.
15
Creating a table
The next step is to create the table that will store the data. To create a table, click on the table button in the data base windows .Then click on the new button. A new table dialog box will appear displaying option of data sheet view, design view table wizard as well as import and link. The first option datasheet view is used to view the data stored in table to build up a table from a scratch, click on design view option and click ok. A field name can have maximum 64 characters and have any character num number ber and and spac spaces es exce except pt for for the the peri period od (.) (.) Squa Square re brac bracke kets ts [ ] and and exclamation marks (!)
16
Design View(Login Table)
17
Design View(Basic Information Table)
18
Design View(Salary Information Table)
19
Design View(Deleted Employee Records Table)
20
Design View(Deleted Salary Records Table)
21
Design View(Set Salary Table)
22
Login
23
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Combo1_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Or (KeyAscii >= 48 And KeyAscii <= 57) Then Combo1.Locked = False Else Combo1.Locked = True End If End Sub Private Sub Combo2_KeyPress(KeyAscii As Integer) Combo2.Locked = True End Sub Private Sub Combo2_KeyUp(KeyCode As Integer, Shift As Integer) Combo2.Locked = False End Sub Private Sub Command1_Click() f = Combo1.Text rs.MoveFirst rs.Find ("username1='" & f & "'") p = rs(1) q = rs(2) If p = Text2.Text And q = Combo2.Text Then 24
MsgBox "Welcome to Payroll Management System", , "project" Payroll.Show Else MsgBox "Invalid login,please retry.Check the status of Caps Lock key whether it is On or Off and check user account type and check you have filled correct username ", , "message" Combo1.Text = "" Text2.Text = "" Combo2.Text = "" Combo1.SetFocus End If End Sub Private Sub Command3_Click() Unload Login End Sub Private Sub Command4_Click() a = MsgBox("Do you want to add user?", vbYesNo) If a = 6 Then If Combo2.Text = "User" Then rs.AddNew rs(0) = Combo1.Text rs(1) = Text2.Text rs(2) = Combo2.Text rs.Update MsgBox "New user created" Combo1.Clear Text2.Text = "" 25
Combo2.Text = "" rs.MoveFirst While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend Else MsgBox "you can't create it" Combo1.Text = "" Text2.Text = "" Combo2.Text = "" Combo1.SetFocus End If Else Combo1.Text = "" Text2.Text = "" Combo2.Text = "" End If End Sub Private Sub Command5_Click() a = MsgBox("Do you want to delete?", vbYesNo) If a = 6 Then f = Combo1.Text rs.MoveFirst rs.Find ("username1='" & f & "'") p = rs(1) q = rs(2) 26
If p = Text2.Text And q = Combo2.Text Then rs.Delete MsgBox "user deleted" rs.MoveFirst Else MsgBox "User can't delete" End If Combo1.Clear Text2.Text = "" Combo2.Text = "" rs.MoveFirst While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend Else Combo1.Text = "" Text2.Text = "" Combo2.Text = "" End If End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open 27
rs.Open "login", cn, adOpenDynamic, adOpenDynamic, adLockOptimistic, adLockOptimistic, adCmdTablea While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend Combo2.AddItem ("Administrator") Combo2.AddItem ("User") End Sub
28
Payroll Management System(MDI form)
29
Private Sub emi_Click() Employeeinfo.Show End Sub Private Sub emp1_Click() AddEmployee.Show End Sub Private Sub emp2_Click() ViewEmployeeinfo.Show End Sub Private Sub emp3_Click() UpdateEmployee.Show End Sub Private Sub emp4_Click() SearchEmployee.Show End Sub Private Sub emp5_Click() Deleteemployee.Show End Sub Private Sub erec_Click() Deletedrecord.Show End Sub Private Sub ex_Click() Unload Me End Sub 30
Private Sub lin_Click() Login.Show End Sub Private Sub pay_Click() Payslip.Show End Sub Private Sub sal1_Click() AddSalary.Show End Sub Private Sub sal2_Click() Salaryinfo.Show End Sub Private Sub salinfo_Click() EmployeeReport.Show End Sub Private Sub salrec_Click() Recordedsal.Show End Sub Private Sub si_Click() Retrievesalaryinfo.Show End Sub
31
Add Employee Information
32
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Dim ro As ADODB.Recordset Private Sub Combo1_KeyPress(KeyAscii As Integer) Combo1.Locked = True End Sub Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Combo2_Click() f = Combo2.Text ro.MoveFirst ro.Find ("Designation='" & f & "'") Text3.Text = ro(1) End Sub Private Sub Combo2_KeyPress(KeyAscii As Integer) Combo2.Locked = True End Sub Private Sub Combo2_KeyUp(KeyCode As Integer, Shift As Integer) Combo2.Locked = False End Sub Private Sub Combo3_KeyPress(KeyAscii As Integer) Combo3.Locked = True End Sub Private Sub Combo3_KeyUp(KeyCode As Integer, Shift As Integer)
33
Combo3.Locked = False End Sub Private Sub Command1_Click() a = MsgBox("Do you want to add?", vbYesNo) If a = 6 Then rs.AddNew rs(0) = Text1.Text rs(1) = Text2.Text rs(2) = Combo3.Text rs(3) = Combo2.Text rs(4) = Text3.Text rs(5) = DTPicker1.Value rs(6) = DTPicker2.Value rs(7) = Text4.Text rs(8) = DTPicker3.Value rs(9) = Text6.Text If Option1.Value = True Then rs(10) = "Male" Else rs(10) = "Female" End If rs(11) = Combo1.Text rs(12) = Text7.Text rs(13) = Text8.Text rs.Update MsgBox "record inserted" rs.MoveFirst 34
rs.MoveLast eno = rs(0) Text1.Text = eno + 1 Text2.Text = "" Combo2.Text = "" Combo3.Text = "" Text3.Text = "" Text4.Text = "" Text6.Text = "" If Option1.Value = True Then Option1.Value Option1.Value = False Else Option2.Value Option2.Value = False End If Combo1.Text = "" Text7.Text = "" Text8.Text = "" Else Text2.Text = "" Combo2.Text = "" Combo3.Text = "" Text3.Text = "" Text4.Text = "" Text6.Text = "" If Option1.Value = True Then Option1.Value Option1.Value = False Else 35
Option2.Value Option2.Value = False End If Combo1.Text = "" Text7.Text = "" Text8.Text = "" End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\Payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable Set ro = New Recordset ro.Open "setsalary", cn, adOpenDynamic, adLockOptimistic, adCmdTable If rs.EOF = True Then Text1.Text = 101 Else rs.MoveLast eno = rs(0) Text1.Text = eno + 1 End If Combo2.AddItem ("Manager") 36
Combo2.AddItem ("Assistant Manager") Combo2.AddItem ("Foreman") Combo2.AddItem ("Supervisor") Combo2.AddItem ("Clerk") Combo2.AddItem ("Computer Operator") Combo2.AddItem ("Subordinate") Combo2.AddItem ("Worker") Combo3.AddItem ("Production") Combo3.AddItem ("Sales") Combo3.AddItem ("Purchase") Combo3.AddItem ("Finance") Combo3.AddItem ("Office") Combo3.AddItem ("Personnel") Combo1.AddItem ("MBA") Combo1.AddItem ("MCA") Combo1.AddItem ("MSC(IT)") Combo1.AddItem ("M.A.") Combo1.AddItem ("M.COM") Combo1.AddItem ("BBA") Combo1.AddItem ("BCA") Combo1.AddItem ("BSC(IT)") Combo1.AddItem ("B.A.") Combo1.AddItem ("B.COM") Combo1.AddItem ("PGDBM") End Sub Private Sub Text2_KeyPress(KeyAscii As Integer)
37
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Then Text2.Locked = False Else Text2.Locked = True End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Or KeyAscii = 46 Then Text4.Locked = False Else Text4.Locked = True End If End Sub Private Sub Text6_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Or KeyAscii = 44 Or KeyAscii = 46 Then Text6.Locked = False Else Text6.Locked = True End If End Sub Private Sub Text7_LostFocus() a1 = Text7.Text 38
a=0 b = 0 l = Len(a1) For i = 1 To l ch = Mid(a1, i, 1) If ch = "@" Then a=a+1 p = i End If If ch = "." Then b = b + 1 p1 = i End If Next If a > 1 Or b = 0 Or a = 0 Or p = 1 Or p1 = l Or p1 = p + 1 Then MsgBox "invalid email id" Text7.SetFocus End If End Sub Private Sub Text8_KeyPress(KeyAscii As Integer) If KeyAscii = 8 Or KeyAscii = 45 Or KeyAscii >= 48 And KeyAscii <= 57 Then Text8.Locked = False Else Text8.Locked = True End If End Sub 39
View Employee Information
40
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Command1_Click() rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub Private Sub Command2_Click() 41
rs.MoveLast Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Command4_Click() rs.MoveNext If rs.EOF = True Then MsgBox "This is the last record" 42
rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) 43
Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End If End Sub Private Sub Command5_Click() rs.MovePrevious If rs.BOF = True Then MsgBox "This is the first record" rs.MoveNext Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) 44
Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End If End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString="provider=microsoft.jet.oledb.4.0 cn.ConnectionString="provider=microsoft.jet.oledb.4.0;datasource=E:\kanc ;datasource=E:\kanc han\payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) 45
Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub
46
Add Salary Information
47
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Dim ro As ADODB.Recordset Private Sub Combo1_Click() m = Combo2.Text id = Combo1.Text rs.Close rs.Open "select * from salary where employee_id='" & id & "' and Salary_month='" & m & "'", cn, adOpenDynamic, adLockOptimistic, adLockOptimistic, adCmdText c=0 While Not rs.EOF c=c+1 rs.MoveNext Wend If c = 0 Then ro.MoveFirst ro.Find ("Employee_id='" & id & "'") Text2.Text = ro(1) Text3.Text = ro(2) Text4.Text = ro(3) Text5.Text = ro(4) Text6.Text = (Val(Text5.Text) * 15) / 100 Text7.Text = (Val(Text5.Text) * 7) / 100 48
Text8.Text = (Val(Text5.Text) * 10) / 100 Text9.Text = (Val(Text5.Text) * 5) / 100 Text10.Text = (Val(Text5.Text) * 8) / 100 Text11.Text = Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text) + Val(Text9.Text) + Val(Text10.Text) Text12.Text = (Val(Text11.Text) * 18) / 100 Text13.Text = (Val(Text11.Text) * 12) / 100 Text14.Text = (Val(Text11.Text) * 8) / 100 Text15.SetFocus Else MsgBox "Salary already added" End If End Sub Private Sub Combo1_KeyPress(KeyAscii As Integer) Combo1.Locked = True End Sub Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Combo2_Click() m = Combo2.Text Select Case m Case "Jan" n=1 Case "Feb" n=2 Case "Mar" 49
n=3 Case "Apr" n=4 Case "May" n=5 Case "June" n=6 Case "July" n=7 Case "Aug" n=8 Case "Sep" n=9 Case "Oct" n = 10 Case "Nov" n = 11 Case "Dec" n = 12 End Select If n = Month(Date) - 1 Then Combo1.Locked = False Else Combo1.Locked = True End If End Sub Private Sub Combo2_KeyPress(KeyAscii As Integer) 50
Combo2.Locked = True End Sub Private Sub Combo2_KeyUp(KeyCode As Integer, Shift As Integer) Combo2.Locked = False End Sub Private Sub Command1_Click() a = MsgBox("Do you want to add?", vbYesNo) If a = 6 Then rs.AddNew rs(0) = Combo1.Text rs(1) = Text2.Text rs(2) = Text3.Text rs(3) = Text4.Text rs(4) = Text5.Text rs(5) = Text6.Text rs(6) = Text7.Text rs(7) = Text8.Text rs(8) = Text9.Text rs(9) = Text10.Text rs(10) = Text11.Text rs(11) = Text12.Text rs(12) = Text13.Text rs(13) = Text14.Text rs(14) = Text15.Text rs(15) = Text16.Text rs(16) = Text17.Text rs(17) = Combo2.Text 51
rs.Update MsgBox "record inserted" rs.MoveFirst Combo1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" Text11.Text = "" Text12.Text = "" Text13.Text = "" Text14.Text = "" Text15.Text = "" Text16.Text = "" Text17.Text = "" Else Combo1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" 52
Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" Text11.Text = "" Text12.Text = "" Text13.Text = "" Text14.Text = "" Text15.Text = "" Text16.Text = "" Text17.Text = "" End If End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset Set ro = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "salary", cn, adOpenDynamic, adLockOptimistic, adLockOptimistic, adCmdTable ro.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable While Not ro.EOF Combo1.AddItem ro(0) 53
ro.MoveNext Wend End Sub Private Sub Text15_Change() Text16.Text = Int((Val(Text5.Text) * Val(Text15.Text)) / 30) Text17.Text = Int(Val(Text11.Text) - Val(Text12.Text) - Val(Text13.Text) Val(Text14.Text) - Val(Text16.Text)) End Sub Private Sub Text15_KeyPress(KeyAscii As Integer) If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Then Text15.Locked = False Else Text15.Locked = True End If End Sub
54
View Salary Information
55
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Dim ro As ADODB.Recordset Private Sub Command1_Click() rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End Sub Private Sub Command2_Click() rs.MoveLast 56
Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Command4_Click() rs.MoveNext If rs.EOF = True Then MsgBox "This is the last record" rs.MoveFirst 57
Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) 58
Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End If End Sub Private Sub Command5_Click() rs.MovePrevious If rs.BOF = True Then MsgBox "This is the first record" rs.MoveNext Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) 59
Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End If End Sub Private Sub Command6_Click() a = MsgBox("Do you want to delete?", vbYesNo) If a = 6 Then ro.AddNew ro(0) = Text1.Text ro(1) = Text2.Text ro(2) = Text3.Text ro(3) = Text4.Text ro(4) = Text5.Text ro(5) = Text6.Text ro(6) = Text7.Text ro(7) = Text8.Text ro(8) = Text9.Text ro(9) = Text10.Text ro(10) = Text11.Text ro(11) = Text12.Text 60
ro(12) = Text13.Text ro(13) = Text14.Text ro(14) = Text15.Text ro(15) = Text16.Text ro(16) = Text17.Text ro(17) = Text18.Text ro.Update rs.Delete MsgBox "Salary information deleted" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" Text11.Text = "" Text12.Text = "" Text13.Text = "" Text14.Text = "" Text15.Text = "" Text16.Text = "" Text17.Text = "" Text18.Text = "" 61
Else MsgBox "Salary information not deleted" End If End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset Set ro = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0; ledb.4.0; datasource=E:\kanchan\payroll.mdb" cn.Open rs.Open "salary", cn, adOpenDynamic, adLockOptimistic, adLockOptimistic, adCmdTable ro.Open "salrecord", cn, adOpenDynamic, adLockOptimistic, adCmdTable Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) 62
Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End Sub
63
Search Employee Information
64
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Combo1_KeyPress(KeyAscii As Integer) Combo1.Locked = True End Sub Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Command1_Click() MsgBox "Record is Searched" f = Combo1.Text rs.MoveFirst rs.Find ("employee_id='" & f & "'") Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then
65
Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend End Sub
66
Search Salary Information
67
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Combo1_KeyPress(KeyAscii As Integer) Combo1.Locked = True End Sub Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Command1_Click() MsgBox "Record is Searched" f = Combo1.Text rs.MoveFirst rs.Find ("employee_id='" & f & "'") Text1.Text = rs(1) Text2.Text = rs(3) Text3.Text = rs(2) Text4.Text = rs(4) End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset
68
cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend End Sub
69
Update Employee Information
70
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Dim ro As ADODB.Recordset Private Sub Combo1_Click() f = Combo1.Text rs.MoveFirst rs.Find ("employee_id='" & f & "'") Text2.Text = rs(1) Combo3.Text = rs(2) Combo2.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub 71
Private Sub Combo1_KeyPress(KeyAscii As Integer) Combo1.Locked = True End Sub Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Combo2_Click() f = Combo2.Text ro.MoveFirst ro.Find ("Designation='" & f & "'") Text5.Text = ro(1) End Sub Private Sub Combo2_KeyPress(KeyAscii As Integer) Combo2.Locked = True End Sub Private Sub Combo2_KeyUp(KeyCode As Integer, Shift As Integer) Combo2.Locked = False End Sub Private Sub Combo3_KeyPress(KeyAscii As Integer) Combo3.Locked = True End Sub Private Sub Combo3_KeyUp(KeyCode As Integer, Shift As Integer) Combo3.Locked = False End Sub Private Sub Command1_Click() a = MsgBox("Do you want to update?", vbYesNo) If a = 6 Then 72
rs(1) = Text2.Text rs(2) = Combo3.Text rs(3) = Combo2.Text rs(4) = Text5.Text rs(5) = Text6.Text rs(6) = Text7.Text rs(7) = Text8.Text rs(8) = Text9.Text rs(9) = Text10.Text rs(10) = Text11.Text rs(11) = Text12.Text rs(12) = Text13.Text rs(13) = Text14.Text rs.Update MsgBox "record is updated" Else MsgBox "record is not updated" Text2.Text = rs(1) Combo3.Text = rs(2) Combo2.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) 73
Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End If End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Form_Load() Set ro = New Recordset Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend ro.Open "setsalary", cn, adOpenDynamic, adLockOptimistic, adCmdTable Combo2.AddItem ("Manager") Combo2.AddItem ("Assistant Manager") 74
Combo2.AddItem ("Foreman") Combo2.AddItem ("Supervisor") Combo2.AddItem ("Clerk") Combo2.AddItem ("Computer Operator") Combo2.AddItem ("Subordinate") Combo2.AddItem ("Worker") Combo3.AddItem ("Production") Combo3.AddItem ("Sales") Combo3.AddItem ("Purchase") Combo3.AddItem ("Finance") Combo3.AddItem ("Office") Combo3.AddItem ("Personnel") End Sub Private Sub Text10_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Or KeyAscii = 44 Or KeyAscii = 46 Then Text10.Locked = False Else Text10.Locked = True End If End Sub Private Sub Text11_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Then Text11.Locked = False Else 75
Text11.Locked = True End If End Sub Private Sub Text12_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Then Text12.Locked = False Else Text12.Locked = True End If End Sub Private Sub Text13_LostFocus() a1 = Text7.Text a=0 b = 0 l = Len(a1) For i = 1 To l ch = Mid(a1, i, 1) If ch = "@" Then a=a+1 p = i End If If ch = "." Then b = b + 1 p1 = i End If Next 76
If a > 1 Or b = 0 Or a = 0 Or p = 1 Or p1 = l Or p1 = p + 1 Then MsgBox "invalid email id" Text13.SetFocus End If End Sub Private Sub Text14_KeyPress(KeyAscii As Integer) If KeyAscii = 8 Or KeyAscii >= 48 And KeyAscii <= 57 Then Text14.Locked = False Else Text14.Locked = True End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Then Text2.Locked = False Else Text2.Locked = True End If End Sub Private Sub Text5_KeyPress(KeyAscii As Integer) If KeyAscii = 8 Or KeyAscii >= 48 And KeyAscii <= 57 Then Text5.Locked = False Else Text5.Locked = True End If End Sub 77
Private Sub Text6_KeyPress(KeyAscii As Integer) If KeyAscii = 8 Or KeyAscii = 45 Or KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 47 Then Text6.Locked = False Else Text6.Locked = True End If End Sub Private Sub Text7_KeyPress(KeyAscii As Integer) If KeyAscii = 8 Or KeyAscii = 45 Or KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 47 Then Text7.Locked = False Else Text7.Locked = True End If End Sub Private Sub Text8_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 32 Or KeyAscii = 46 Then Text8.Locked = False Else Text8.Locked = True End If End Sub Private Sub Text9_KeyPress(KeyAscii As Integer)
78
If KeyAscii = 8 Or KeyAscii = 45 Or KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 47 Then Text9.Locked = False Else Text9.Locked = True End If End Sub
79
Delete Employee Information
80
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Dim ro As ADODB.Recordset Private Sub Combo1_Click() f = Combo1.Text rs.MoveFirst rs.Find ("employee_id='" & f & "'") Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No email-id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub Private Sub Combo1_KeyPress(KeyAscii As Integer) 81
Combo1.Locked = True End Sub
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Command1_Click() a = MsgBox("Do you want to delete?", vbYesNo) If a = 6 Then f = Combo1.Text rs.MoveFirst rs.Find ("employee_id='" & f & "'") ro.AddNew ro(0) = rs(0) ro(1) = rs(1) ro(2) = rs(2) ro(3) = rs(3) ro(4) = rs(4) ro(5) = rs(5) ro(6) = rs(6) ro(7) = rs(7) ro(8) = rs(8) ro(9) = rs(9) ro(10) = rs(10) ro(11) = rs(11) ro(12) = rs(12) ro(13) = rs(13) 82
ro.Update rs.Delete Combo1.Text = "" Combo1.Clear rs.MoveFirst While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" Text11.Text = "" Text12.Text = "" Text13.Text = "" Text14.Text = "" MsgBox "Record deleted" Else MsgBox "Record is not deleted" End If End Sub 83
Private Sub Command2_Click() Salaryinfo.Show End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset Set ro = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend ro.Open "record", cn, adOpenDynamic, adOpenDynamic, adLockOptimistic, adCmdTable End Sub
84
Deleted Records Information
85
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Command1_Click() rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub Private Sub Command2_Click() rs.MoveLast Text1.Text = rs(0) Text2.Text = rs(1) 86
Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Command4_Click() rs.MoveNext If rs.EOF = True Then MsgBox "This is the last record" rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) 87
Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) 88
Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End If End Sub Private Sub Command5_Click() rs.MovePrevious If rs.BOF = True Then MsgBox "This is the first record" rs.MoveNext Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) 89
Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End If End Sub Private Sub Command6_Click() Recordedsal.Show End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "record", cn, adOpenDynamic, adLockOptimistic, adLockOptimistic, adCmdTable Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) 90
Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) If rs(12) = "If yes then type" Then Text13.Text = "No e-mail id" Else Text13.Text = rs(12) End If Text14.Text = rs(13) End Sub
91
Deleted Salary Records Information
92
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Command1_Click() rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End Sub Private Sub Command2_Click() rs.MoveLast Text1.Text = rs(0) Text2.Text = rs(1) 93
Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Command4_Click() rs.MoveNext If rs.EOF = True Then MsgBox "This is the last record" rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) 94
Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) 95
Text11.Text = rs(10) Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End If End Sub Private Sub Command5_Click() rs.MovePrevious If rs.BOF = True Then MsgBox "This is the first record" rs.MoveNext Else Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) 96
Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End If End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "salrecord", cn, adOpenDynamic, adLockOptimistic, adLockOptimistic, adCmdTable Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text = rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10) 97
Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13) Text15.Text = rs(14) Text16.Text = rs(15) Text17.Text = rs(16) Text18.Text = rs(17) End Sub
98
Employee Detail
99
Dim cn As ADODB.Connection ADODB.Connection Dim rs As ADODB.Recordset Private Sub Combo1_KeyPress(KeyAscii As Integer) Combo1.Locked = True End Sub Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer) Combo1.Locked = False End Sub Private Sub Command1_Click() s = Combo1.Text DataEnvironment3.Command1 DataEnvironment3.Comma nd1 (s) DataReport3.Show End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Set cn = New Connection Set rs = New Recordset cn.ConnectionString = "provider=microsoft.jet.o "provider=microsoft.jet.oledb.4.0;data ledb.4.0;data source=E:\kanchan\payroll.mdb" cn.Open rs.Open "basic", cn, adOpenDynamic, adLockOptimistic, adCmdTable While Not rs.EOF Combo1.AddItem rs(0) rs.MoveNext Wend End Sub 100