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

Chate Coaching Classes [Borivali Branch]

1. INTRODUCTION

This project is being made for CHATE COACHING CLASSES [Borivali branch], a
renowned classes which provides coaching to students of standard 8th to S.Y.J.C.

The entire data of the faculty as well as of the enrolled students was being written and
managed manually. But as this caused much incontinence the idea of developing this new
system came up.

Activity, academic has been “CHATE COACHING CLASSES” forte.

The “CHATE COACHING CLASSES” students proved their mettle by hitting headlines
in their respective examinations.

The student here, one of large family and it is in their interest that personal care of each
student is taken. Members of the Staff motivate them into action and no stone is lifting
unturned to bring out the hidden best in each student.

1
Chate Coaching Classes [Borivali Branch]

2.Planning

2.1Defining the problem:


A complete computerized system which would maintain the entire data details would be
provided.
The new system would be capable of supporting inquiry follow-up.
The data stored in the system would be comparatively secured.
The new system would be capable of generating salary-slips as well as the fee-receipts.
The system would be capable of keeping track of the attendance details.

2.2Anticipated benefits:
 The entire system would be stored securely and avoid consequences occurring if
any of the registers or ledgers gets lost.

 The required data would be accessed faster and so the new system would be less
time consuming and more work could be done.

 The new system would do the calculations related to fees which would surely
reduce the manual errors made related to it.

 The required data could be accessed easily.

2.3Context Diagram:

Management

Request for Details of


student and Student and
faculty details faculty

details 0 details

Appointment letter
Course Fee receipt
Faculty Registration Student
attendance System attendance

2
Chate Coaching Classes [Borivali Branch]

2.4 Feasibility study:

2.4.1. Economic feasibility:


Even tough the hardware and the software requirements are fulfilled there could be some
other RECURRING COSTS involving later.

2.4.1.1 Anticipated Benefits:


Tangible Costs:
The data could be maintained comparatively more securely.
Accessing the data would be faster.

Intangible Costs:
Increased student satisfaction.
Increased level of service.

A. Developmental Costs:

Expense Category Amount


Salary/wages(of analyst,designer,coder and tester) Rs.24,700

Training Rs.3,300

Facilities Rs.2,200

Rs.1,200
Travel/Miscellaneous
Licenses Rs.6,000
Total Rs.37,400

B. Annual Operating Cost:


Recurring cost Amount
Connectivity Rs.1,000
Equipment maintenance Rs.1,000
Programming Rs.2,500
Help desk Rs.400
Total recurring cost:- Rs.4,900

3
Chate Coaching Classes [Borivali Branch]

C. Benefit/Cost saving Amount Comments


Reducing staff 25,000 ‘5 People @ Rs.5,000’
Reducing Stationary Rs.1,800
Total Annual benefits Rs.27,300
In this way the total amount incurred on project is taken into consideration and is found to be
Feasible

2.4.2 Organizational and Cultural Feasibility:


The user staff, there has the required computer knowledge.
The staff on the client-side is ready and eager to use the system.

2.4.3 Technical Feasibility:


Use aP3 or higher processor.
128 MB of.RAM (minimum).
10GB or higher capacity hard disk.
Operating System-Windows 98(onwards).
Licensed software of VB and MS-ACCESS.
The user is ready for purchasing the above requirement, so it is Technical Feasible.

2.4.4 Schedule Feasibility:


The system would be completed in phases respectively.
The idea of completion of the project would be shown to the client with help of a Gantt
chart.

3.Analysis

3.1 Information Gathering:

4
Chate Coaching Classes [Borivali Branch]

3.1.1 Questionnaires:

1. What different types of records you need or maintain?


2. How the data is maintained in the database?
3. How the attendance of student and faculty maintained in the current system?
4. In what way do you maintain the records in the current system and what are the
disadvantages in following this system?
5. How do you keep track whether the student has paid his fees?
6. How do you maintain the details of student and faculty?
7. When do you generate a Fee Receipt for a student?

3.2 Things:

Things

Incidents ,
Tangible Roles Organisational Sites/
Devices Events or
things played units Locations
Interactions

• Student • Department • Printer • Enrollment • Branch

• Faculty • Keyboard • Faculty- office


• Disk-drive attend •Desktop
• Display -ance
• Mouse • Student
• Menu attendance
• Button

3.3 Entity Relationship Diagram:

5
Chate Coaching Classes [Borivali Branch]

Course Course-
Course
Id*
batch

Course
enrolled

Faculty
Faculty
Id*

Student
Student Inquiry
Id*

Faculty
attenda
nce Student
attendance

3.4 Event Table:

6
Chate Coaching Classes [Borivali Branch]

Event Trigger Source Activity Response Destination


1. Student makes Course details Student Look-up for Inquiry details Student
Course-inquiry inquiry requested inquiry
details
2. Student- entry of new Student Generate Admission Student
Enrollment student details Confirmation Confirmation
3. Student wants to entry of updated Student update student’s - -
update his Course Course details Course details
details
4. Student wants to entry of updated Student update student’s - -
update his Personal details personal details
Personal details
5. Student gives attendance Student update attendance - -
Attendance details details
details
6. Faculty entry of new Faculty Generate Appointment Faculty
Appointment faculty details Confirmation Confirmation
7. Faculty wants to entry of updated Faculty update faculty’s - -
update his details details personal details
8. Faculty gives attendance Faculty update attendance - -
Attendance details details
details
9. Time to produce End of the - produce Attendance Management
Attendance report month Attendance report report
10. Time to produce End of the - produce Inquiry Inquiry report Management
Inquiry report month report

3.5 DFD Fragments:

7
Chate Coaching Classes [Borivali Branch]

Course details inquiry


Offered
Lookup for course
Student
inquiry
Course details
details
Inquiry

Request entry of student details Student


Student Student
enrollment
Coursed
Admission confirmation
enrolled

8
Chate Coaching Classes [Borivali Branch]

3
Update Student
student’s
Student Update course details
Course
details
Course Text
enrolled

4
Update
Student’s
Student Update personal details Student
personal
details

9
Chate Coaching Classes [Borivali Branch]

5
Student
Request to update student
Record attendance
attendance details
Student student
attendance
deatils

6
Course details inquiry
Faculty
Faculty Faculty
Appointment
Appointment confirmation

10
Chate Coaching Classes [Borivali Branch]

Faculty
Faculty Update details Update
faculty details

Request to update faculty


Record Faculty
Faculty attendance details faculty attendance
attendance
details

11
Chate Coaching Classes [Borivali Branch]

Student

Student
9 Attendance

Produce
attendance Faculty
Management Attendance report
report

Faculty
Attendance

10

Student
Management Inquiry report Produce
Inquiry report
Course
enrolled

3.6 Event partition Diagram:

12
Chate Coaching Classes [Borivali Branch]

Attendance details
Admission confirmation
Entry of new student details Student
Course details inquiry 10

Produce
Inquiry details Inquiry report Inquiry report
Offered
course
1

Lookup for
inquiry Faculty
details Inquiry Update
7 details

Update
Faculty
2 details
Student
Student
enrollment

Course 4 Update
enrolled Update personal
Student details
Student
5
Personal
Record
details
student
attendance Student
details Update course
attendance 3 details
Update
Student
Appointment course details
6
confirmation
Faculty
Entry of new Faulty
details appointment Management
9 Attendanc
Faculty Produce e report
8 attendance Attendance
Record Report
faculty
attendance
details
Attendance
details

Faculty

3.7 DFD Decomposition:

13
Chate Coaching Classes [Borivali Branch]

Student

1.1 1.2
Inquiry RecordStudent
the
Record course for
student which inquiry
information was made

Student

3.1 3.2
Course
enrolled
Update Generate
course details confirmation
Student

2.1 2.3

Record Student Generate


student confirmation
details
Course
enrollment

2.2

Record
course details

14
Chate Coaching Classes [Borivali Branch]

3.8 Process Description:

3.8.1 Structured English:

1. Process Look- up for the inquiry details:


 Look up for the inquiry information details in the data store of offered course.
 Record the entry of the student who inquired and for which course in the inquiry
data store.
 End Process of look- up for the inquiry details.

2. Process Student-enrollment:
 Get the student details.
 If new student then
Generate new student-id
Add the student details to the student data store
Else
Add the new course-enrollment in the data store of course-enrollment and
in student data store.
 Collect amount course-fees and make the entry of paid course-fees in the system.
 Generate fee-receipt for the paid course-fees.
 End Process Student-enrollment.

3. Process Update student course details:


 Get the updated details from the student.
 Make the required changes in the data store of student and in the coursed-
enrolled.
 End Process Update student course details.

4. Process Update student personal details:


 Get the updated details from the student.
 Make the required changes in the data store of student.
 End Process Update student personal details.

15
Chate Coaching Classes [Borivali Branch]

5. Process Record student-attendance details:


 Get the signed attendance-sheet.
 Enter the details of attendance from the attendance in the student-attendance data
store.
 End Process of record student-attendance details.

6. Process Faculty-appointment:
 Get the faculty details.
 If new faculty then
Generate new faculty-id.
Add the details to the faculty data store
Else
Add the new enrollment in faculty data store.

 Generate appointment letter for the new faculty.


 End Process Faculty-appointment.

7. Process Update faculty details:


 Get the updated details from the faculty.
 Make the required changes in the data store of faculty.
 End Process Update faculty details.

8. Process Record faculty-attendance details:


 Get the signed attendance-sheet.
 Enter the details of attendance from the attendance in the faculty-attendance data
store.
 End Process of updating faculty-attendance details.

9. Process Produce attendance-report:


 Get the attendance-details from the data stores of student-attendance and faculty-
attendance.
 Generate an attendance-report of both students as well as of faculty at end of the
week mentioning the defaulters’ name.
 End Process of producing attendance-report.

10. Process Produce Inquiry report:

16
Chate Coaching Classes [Borivali Branch]

 Get the details from the inquiry data store.


 Generate the Inquiry report.
 End Process Produce Inquiry report.

3.8.2 Data Flow Definitions:

Course details = {subjects} +fees+


timings+faculty-name

Admission confirmation =student-id+course-enrollment+payed course


fees

Appointment confirmation =faculty-id+faculty-name+ {subjects} +pay


offered

Attendance report details =student-id+student-name


+student-attendance+faculty-id+
faculty-name+faculty-attendance

Inquiry report =inquiry details+inquiry no. + Inquiry date


+ Inquired student name
+inquired student contact no.

3.8.3 Data Element Definition:

1. Name-description:
A text field containing maximum of 42 characters.

2. Address-description:
A text field containing a maximum of 70 characters.

17
Chate Coaching Classes [Borivali Branch]

3. Unit-Contact no.:
A text field containing only positive nos. of maximum 10 integers.

4. Unit-Birth date:
Positive nos. and some special symbols together in a text field containing maximum of
10 characters.

5. Unit-Fees:
A positive real no. accurate to two decimal places, always in Rs.

6. Unit-Salary:
A positive real no. accurate to two decimal places, always in Rs.

7. Unit-Attendance:
A positive integer.

3.8.4 Data Store Definition:

1. Inquiry=
date
no.
student name
contact no.
about

2. Course Master=
course-id
course-name
course-fees
3. Batch Master=

batch-id
batch name
batch timings
course-id

18
Chate Coaching Classes [Borivali Branch]

4. Course Subject=
course id
subject id

5. Faculty subjects=
Faculty id
course id
{subject id}

6. Subject Master=
subject id
subject name

7. Payment Record=
student id
Mode of payment
Bank name
Cheque no.
Date of payment
Amount Received
Receipt no.
Total amount paid

8. Course enrolled=
student-id
batch -id

9. Student=
id
Date of admission
Roll no.
name
sex
mobile no.
residence no.
course-enrolled
Guardian name
Guardian no.
Address

19
Chate Coaching Classes [Borivali Branch]

10. Student attendance=


Date
id
course-batch
status
name
contact no.

11. Faculty=
id
name
date of joining
course name
{subject}
mobile no.
residence no.
address

12. Faculty attendance=


Date
id
status

20
Chate Coaching Classes [Borivali Branch]

4.Design
4.1Automation Boundary:

21
Chate Coaching Classes [Borivali Branch]

Admission confirmation
Entry of new student details
Student Faculty
Course details inquiry attendance details
Update
Inquiry details
details Entry of new
1
details
offered
Lookup for Appointment
course 6
course details confirmation
Faculty
Faculty
inquiry appointment

7
2 Update
Faculty
Student details
enrollment

student
Course
3 enrolled
Update
Student 8
course details Faculty Record
attendance faculty
attendance
details
4
Update
Student
personal
details

9
Produce
5 Attendance
Record Report
Student
Text

student
attendance
attendance
details
10

Produce
Inquiry
report

attendance details
Update personal Student Management Inquiry report
details
Update course details Attendance report

4.2 System Flowchart:

22
Chate Coaching Classes [Borivali Branch]

Student
Student Details
Enrollment Maintainance
Program Program

Student
Student Attendance

Course
Enrolled
Student
Attendance
Maintainance
Program
Faculty
Faculty
Details
Maintainance
Program Faulty
Attendance
Maintainance
Program

Admission
Faulty
Confirmation
Appointment
Program Faculty
Attendance

Offered Produce
Course Attendance
Maintainance
Program

Appointment
Confirmation
Attendance
Report
Inquiry Inquiry report
Program Inquiry

23
Chate Coaching Classes [Borivali Branch]

4.3 Structure Chart:

selection
Get request Admission
System

Student Faculty Attendance


Inquiry Maintainance Maintainance
program
enrollment Appointment
program program
program program
Appointment
confirmation
Inquiry

Student
details

details
confirmation
Admission
inquiry
Details
course

Faculty
details

Lookup
for Faculty
requested Student
appointment Student Faculty Student Faculty
course enrollment
details
report

personal details

personal de

attendance
Student

attendance
faculty details

Student
inquiry

Faculty
Course
Student

Studen

details
Student

Student
faculty
course
details

details
course
info

details
Inquiry

faculty
course
details

ta
confirmation

Appoin tion
confirm

t
Admission

ils

Attendance

Attendance
detail

report

report
tment

s
a

Reco Upda Upda


Gene Reco Gene Gene
Reco rd Record Reco Record te te Upda Record Record
rate rd Gene Gene rate rate
rd perso course rd course perso cours te course course
Inqui stude rate rate Atten Atten
cours nal details detail details nal e detail details details
ry nt confi confi danc danc
e detail of s of of detail detail s of of of
repor infor rmati rmati e e
inqui s of student facult faculty s of s of facult faculty faculty
t matio on on repor repor
ry stude y stude stude y
n t t
nt nt nt

4.4 Database design:

24
Chate Coaching Classes [Borivali Branch]

1) Table Name: Student

Field Name Data Type Size Constraint Description


StudentId Number Long integer Primary key Unique Student identification
Not null
DateOfAdmission
Date/Time Short date Not null Date of Admission
RollNo Text Long integer Not null Unique Student Roll No.
Student Name Text 50 Not null Student name
Sex Text Long integer Not null Gender of the Student
MobileNo. Text 15 Not null Student contact no
ResidenceNo. Text 15 Not null Student contact no
GuardiansNameText 50 Not null Student’s Guardian’s Name
GuardiansNo. Text 15 Not null Student’s Guardian’s No.
Address Text 15 Not null Student Address

2) Table Name: BatchMaster

Field Name Data Type Size Constraint Description


BatchIdId Number Long integer Primary key Unique Batch identification
Not null
BatchName Text 20 Not null Batch name
BatchTimings Date/Time Short date Not null Batch timings
CourseId Number Long integer Not null Id of the Course to which
Batch belongs to.

3) Table Name: CourseEnrolled

Field Name Data Type Size Constraint Description


StudentId Number Long integer Not null Unique Student
identification
BatchId Number Long integer Not null BatchId

4) Table Name: courseMaster

Field Name Data Type Size Constraint Description


CourseId Number Long integer Primary key Unique Course identification
Not null
CourseName Text 20 Not null Course name
CourseFees Currency Standard Not null Fees of the Course

5) Table Name: Coursesubject

25
Chate Coaching Classes [Borivali Branch]

Field Name Data Type Size Constraint Description


CourseId Number Long integer Not null Unique Course identification
SubjectId Number Long integer Not null Unique Subject Identification

6) Table Name: Faculty

Field Name Data Type Size Constraint Description


FacultyId Number Long integer Primary key Unique Faculty identification
Not null
FacultyName Text 50 Not null Faculty Name
DateOfJoining Date/Time Short date Not null Date of Appointment
CourseName Text 50 Not null Name of course
SubjectName1 Text 50 Not null Name of Subject alloated to
SubjectName2 Text 50 Not null Name of Subject alloated to
MobileNo Text 50 Not null Contact No.
ResidenceNo Text 50 Not null Contact No.
Address Text 75 Not null Address of Faculty

7) Table Name: FacultyAttendance

Field Name Data Type Size Constraint Description


Date Date/Time Short date Not null Date of Attendance
FacultyId Text Long integer Not null Unique Faculty identification
Status Text 50 Not null Status:present or absent

8) Table Name: FacultySubjects

Field Name Data Type Size Constraint Description


CourseId Number Long integer Not null Course Identification
SubjectId1 Number Long integer Not null First Subject Identification
SubjectName1 Text 50 Not null Name of Subject alloted to
Faculty
SubjectId2 Number Long integer Not null SecondSubject Identification
SubjectName2 Text 50 Not null Name of Subject alloted to
Faculty
FacultyId Number 50 Not null Unique Faculty identification

26
Chate Coaching Classes [Borivali Branch]

9) Table Name: loginmaster

Field Name Data Type Size Constraint Description


Name Text 50 Not null User Name
Password Text 50 Not null User password

10) Table Name: subjectsMaster

Field Name Data Type Size Constraint Description


SubjectId Number Long integer Primary Key Unique Subject
Not null identification
SubjectName Text 50 Not null name of the subject

11) Table Name: PaymentRecord

Field Name Data Type Size Constraint Description


StudentId. Number Long integer Primary key Student
Not null identification
ModeofPaymentMemo Long integer Not null Mode of Payment
BankName Text 50 Not null Name of bank of which
cheque was received
ChequeNo Number Long integer Not null cheque no.
DateofPayment Date/Time Short Date Not null date on which payment was
received
AmountReceivedCurrency Standard Not null amount received as fees
Receiptno Number Long integer Not null receipt no.
TotalAmtPaid Currency Standard Not null total amt received from the
Student as Fees

12) Table Name: StudentAttendance

Field Name Data Type Size Constraint Description


Date Date/Time Short date Not null Date of Attendance
StudentId Text Long integer Not null Unique Student identification
BatchId Text Long integer Not null Id of batch in which Student
is enrolled
Status Text Long integer Not null Status:present or absent

4.4 Form Design Layout:

27
Chate Coaching Classes [Borivali Branch]

4.4.1Login Form:

(Form Design Layout Contd..)

28
Chate Coaching Classes [Borivali Branch]

4.4.2 Splash Screen:

(Form Design Layout Contd..)

29
Chate Coaching Classes [Borivali Branch]

4.4.3 MDI Form:

(Form Design Layout Contd..)

30
Chate Coaching Classes [Borivali Branch]

4.4.4 Student Details Form:

(Form Design Layout Contd..)

31
Chate Coaching Classes [Borivali Branch]

4.4.5 Search Student Form:

(Form Design Layout Contd..)

32
Chate Coaching Classes [Borivali Branch]

4.4.6 Student Payment DetailsForm:

(Form Design Layout Contd..)

33
Chate Coaching Classes [Borivali Branch]

4.4.7 Fee-Receipt form:

(Form Design Layout Contd..)

34
Chate Coaching Classes [Borivali Branch]

4.4.8 Faculty Details:

(Form Design Layout Contd..)

35
Chate Coaching Classes [Borivali Branch]

4.4.9 Search Faculty Details:

(Form Design Layout Contd..)

36
Chate Coaching Classes [Borivali Branch]

4.4.10 Faculty Appointment form:

(Form Design Layout Contd..)

37
Chate Coaching Classes [Borivali Branch]

4.4.11 Offered Course Form:

(Form Design Layout Contd..)

38
Chate Coaching Classes [Borivali Branch]

4.4.12 Batch Form:

(Form Design Layout Contd..)

39
Chate Coaching Classes [Borivali Branch]

4.4.13 Student Attendance Form:

40
Chate Coaching Classes [Borivali Branch]

(Form Design Layout Contd..)

4.4.14 Search Student Attendance Form:

(Form Design Layout Contd..)

41
Chate Coaching Classes [Borivali Branch]

4.4.15 Faculty Attendance Form:

(Form Design Layout Contd..)

42
Chate Coaching Classes [Borivali Branch]

4.4.16 Search Faculty Attendance Form:

(Form Design Layout Contd..)

43
Chate Coaching Classes [Borivali Branch]

4.4.17 Appointment Letter Form:

(Form Design Layout Contd..)

44
Chate Coaching Classes [Borivali Branch]

4.4.18 Inquiry Details Form:

(Form Design Layout Contd..)

45
Chate Coaching Classes [Borivali Branch]

4.4.18 Call Fee-Receipt Form:

4.4.23 Call Appointment Letter Form:

(Form Design Layout Contd..)

46
Chate Coaching Classes [Borivali Branch]

4.4.20 Call Inquiry Form:

4.4.21 Call Student Attendance Form:

(Form Design Layout Contd..)

47
Chate Coaching Classes [Borivali Branch]

4.4.22 Call Faculty Attendance Form:

(Form Design Layout Contd..)

48
Chate Coaching Classes [Borivali Branch]

4.4.24 Reports Design:

4.4.24.1 Fee-Receipt:

(Form Design Layout Contd..)

49
Chate Coaching Classes [Borivali Branch]

4.4.24.2 Appointment Letter:

4.4.24.3 Monthly produced reports:

4.4.24.3.1 Student Attendance Report:

(Form Design Layout Contd..)

50
Chate Coaching Classes [Borivali Branch]

4.4.24.3.2 Faculty Attendance Report:

(Form Design Layout Contd..)

51
Chate Coaching Classes [Borivali Branch]

4.4.24.3.3 Inquiry Report:

52
Chate Coaching Classes [Borivali Branch]

5. IMPLEMENTATION

5.1Coding:

5.1.1. Module:

Option Explicit
Dim StrSQl As String
Public Conn As ADODB.Connection
Public Function CheckNumBatch(Keyvalue As Integer)
If Keyvalue >= 48 And Keyvalue <= 57 Or Keyvalue = 8 Or Keyvalue = 45 Or Keyvalue
= 58 Then
CheckNumBatch = Keyvalue
Else
CheckNumBatch = 0
End If
End Function

Public Function CheckNum(Keyvalue As Integer)


If Keyvalue >= 48 And Keyvalue <= 57 Or Keyvalue = 8 Or Keyvalue = 45 Then
CheckNum = Keyvalue
Else
CheckNum = 0
End If
End Function

Public Function CheckName(Keyvalue As Integer)


If (Keyvalue >= 65 And Keyvalue <= 90) Or Keyvalue = 8 Or Keyvalue = 46 Or
Keyvalue = 32 Or (Keyvalue >= 97 And Keyvalue <= 122) Then
CheckName = Keyvalue
Else
CheckName = 0
End If
End Function

Public Sub Connect()


Set Conn = New ADODB.Connection
'Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Ashwini Anaredy\MY
T.Y.PROJECT\database.mdb;Persist Security Info=False"
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
"\database.mdb;Persist Security Info=False"
Conn.Open
End Sub

53
Chate Coaching Classes [Borivali Branch]

Public Function getMaxNo(strTbl As String, strKeyFLd As String) As Integer


Dim sql As String
Dim rsMax As ADODB.Recordset
sql = "select max(" & strKeyFLd & ") as MaxNo from " & strTbl
Set rsMax = New ADODB.Recordset
rsMax.Open sql, Conn, adOpenKeyset, adLockOptimistic
If IsNull(rsMax("MaxNo")) Then
getMaxNo = 0
Else
getMaxNo = Val(rsMax("MaxNo"))
End If
End Function
Public Function getdesc(strtable As String, strname As String, cond As String)
Dim sql As String
Dim rsdesc As ADODB.Recordset
sql = "select " & strname & " from " & strtable & " where " & cond & ""
Set rsdesc = New ADODB.Recordset
rsdesc.Open sql, Conn, adOpenKeyset, adLockOptimistic
If Not rsdesc.EOF Then
getdesc = rsdesc(strname)
End If
rsdesc.Close
End Function

Public Sub unloadAllForms()


Dim frm As Variant
For Each frm In Forms
If UCase(frm.Name) <> "frmMDIForm1" Then
Unload frm
End If
Next
End Sub

5.1.2Login Form:

Dim Conn As ADODB.Connection


Dim rs As New ADODB.Recordset

Private Sub Command2_Click()


End Sub
Private Sub cmdcancel_Click()
If vbYes = MsgBox("Do you want to exit", vbYesNo) Then
End
End If

54
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub cmdOK_Click()


Dim str As String
str = "select * from loginmaster where name='" & Trim(txtname) & "' and password='"
& LCase(Trim(txtpass)) & "'"
rs.Open str, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
frmSplash.Show
Unload Me
Else
MsgBox "invalid user"
End If
rs.Close

txtname = ""
txtpass = ""

End Sub

Private Sub Form_Load()

Set Conn = New ADODB.Connection


StrSQl = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
"\database.mdb;Persist Security Info=False"
Conn.Open StrSQl
End Sub

5.1.3 Splash Screen:

Option Explicit

Private Sub Timer1_Timer()


ProgressBar1.Value = ProgressBar1.Value + 1
Label2.Caption = ProgressBar1.Value & "%"
If ProgressBar1.Value = 50 Then

Unload Me
frmMDIForm1.Show
End If

End Sub

5.1.4 MDI Form:

55
Chate Coaching Classes [Borivali Branch]

Option Explicit

Private Sub MDIForm_Load()


Connect
End Sub

Private Sub mnuAppointmentLetter_Click()


unloadAllForms
frmAppointment.Show
End Sub

Private Sub mnuBatch_Click()


unloadAllForms
frmBatch.Show
End Sub

Private Sub mnuExit_Click()


If vbYes = MsgBox("Do you want to exit", vbYesNo) Then
End
End If
End Sub

Private Sub mnuFaculty_Click()


unloadAllForms
frmFacultydetails.Show
End Sub

Private Sub mnuFacultyAppointmentLetter_Click()


unloadAllForms
frmCallFacultyAppointment.Show
End Sub

Private Sub mnuFacultyattendance_Click()


unloadAllForms
frmFacultyAttendance.Show
End Sub

Private Sub mnuFacultyAttendanceReport_Click()


frmCallFacultyAtt.Show
End Sub

Private Sub mnuFeeReceipt_Click()


unloadAllForms
frmFeeReceipt.Show
End Sub

56
Chate Coaching Classes [Borivali Branch]

Private Sub mnuInquirydetails_Click()


unloadAllForms
frmInquirydetails.Show
End Sub

Private Sub mnuInquiryDetailsReport_Click()


unloadAllForms
frmCallInquiryReport.Show
End Sub

Private Sub mnuOfferedcourse_Click()


unloadAllForms
frmOfferedc.Show
End Sub

Private Sub mnuSearchstudentAttendance_Click()


unloadAllForms
frmSearchAttendance.Show
End Sub

Private Sub mnuStudent_Click()


unloadAllForms
frmStudentDetails.Show
End Sub

Private Sub mnuStudentattendance_Click()


unloadAllForms
frmStudentattendance.Show
End Sub

Private Sub mnuStudentAttendanceReport_Click()


unloadAllForms
frmCallStudentAtt.Show
End Sub

Private Sub mnuStudentFeeReceipt_Click()


unloadAllForms
frmCallFeeReceipt.Show
End Sub

5.1.5 Student Details Form:

57
Chate Coaching Classes [Borivali Branch]

Option Explicit
Dim rs, rsenroll As ADODB.Recordset
Dim list As ListItem
Dim UserMode, M, f, Sex As String
Private Sub fillList()

Set rs = New ADODB.Recordset


rs.Open "Select * from Student", Conn, adOpenKeyset, adLockOptimistic
lstStudDetails.ListItems.Clear
While rs.EOF <> True
Set list = lstStudDetails.ListItems.Add(, , Trim(rs("StudentId") & ""))
list.SubItems(1) = Trim(rs("DateOfAdmission") & "")
list.SubItems(2) = Trim(rs("RollNo") & "")
list.SubItems(3) = Trim(rs("StudentName") & "")
list.SubItems(4) = Trim(rs("Sex") & "")
list.SubItems(5) = Trim(rs("MobileNo") & "")
list.SubItems(6) = Trim(rs("ResidenceNo") & "")
list.SubItems(7) = Trim(rs("GuardiansName") & "")
list.SubItems(8) = Trim(rs("GuardiansNo") & "")
list.SubItems(9) = Trim(rs("Address") & "")
rs.MoveNext
Wend

End Sub

Private Sub cboCname_LostFocus()


If cboCname.ListIndex >= 0 Then
fillBatch (cboCname.ItemData(cboCname.ListIndex))
End If
End Sub

Private Sub cmdPayment_Click()


If txtRollNo <> "" Then
frmPayment.txtRollNo = txtRollNo
frmPayment.txtSid = txtSid
End If
frmPayment.SetFocus
End Sub

Private Sub cmdSdAdd_Click()


UserMode = "ADD"

58
Chate Coaching Classes [Borivali Branch]

txtSid = Val(getMaxNo("Student", "StudentId")) + 1


txtRollNo = "S-" & txtSid

cboCoursename.SetFocus
DTPickerSD.Value = Date
txtSfname = ""
txtGname = ""
txtGcontactno = ""
txtSa1 = ""
txtScmo1 = ""
txtScres2 = ""
optMale.Value = False
optFemale.Value = False
cboCname.ListIndex = -1
cboBid.ListIndex = -1

cmdSdDelete.Enabled = False
cmdSdUpdate.Enabled = False
cmdsdCancel.Caption = "Cancel"
cmdSdSave.Enabled = True
cmdSdSearch.Enabled = False
cmdPayment.Enabled = False

Enabledfillings
End Sub

Private Sub cmdsdCancel_Click()


If cmdsdCancel.Caption = "Exit" Then
Unload Me
Exit Sub
End If
cmdsdCancel.Caption = "Exit"
txtSfname = ""
txtRollNo = ""
txtSid = ""
txtGname = ""
txtGcontactno = ""
txtSa1 = ""
txtScmo1 = ""
txtScres2 = ""
cboCname.ListIndex = -1

cboBid.ListIndex = -1
optMale.Value = False

59
Chate Coaching Classes [Borivali Branch]

optFemale.Value = False

cmdSdAdd.Enabled = True
cmdSdUpdate.Enabled = False
cmdSdDelete.Enabled = False
cmdSdSearch.Enabled = True
cmdPayment.Enabled = True
cmdsdCancel.Enabled = True
cmdSdSave.Enabled = False
End Sub

Private Sub cmdSdDelete_Click()


Dim sql, sql1 As String
If vbYes = MsgBox("Are you sure you want to delete this record?", vbYesNo +
vbQuestion, "CHATE COACHING CLASSES") Then
sql = "Select * from Student where StudentId=" & Val(txtSid)
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
If rs.EOF And Not rs.BOF Then
MsgBox "No records to delete"
'Else
' rs.Delete
' rs.Close
End If
rs.Delete
rs.MoveNext
rs.Close
fillList

txtRollNo = ""
txtSid = ""
txtSfname = ""
txtScmo1 = ""
txtScres2 = ""
txtGname = ""
txtGcontactno = ""
cboCname.ListIndex = -1
cboBid.ListIndex = -1

txtSa1 = ""
optMale.Value = False
optFemale.Value = False

End If
cmdsdCancel.Enabled = True
cmdSdAdd.Enabled = False

60
Chate Coaching Classes [Borivali Branch]

cmdSdUpdate.Enabled = False
cmdSdSearch.Enabled = False
cmdPayment.Enabled = False
cmdSdSave.Enabled = False
End Sub

Private Sub cmdSdSave_Click()


If txtSfname = "" Then
MsgBox "Please Enter Student's Name.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
If txtSa1 = "" Then
MsgBox "Please Enter Address.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
'If cboBid.ListIndex = "" Then
'MsgBox "Please Select a Batch.", vbOKOnly, "Chate Coaching Classes "
' Exit Sub
' End If
'If cboCName.ListIndex = "" Then
' MsgBox "Please Select a Course.", vbOKOnly, "Chate Coaching Classes "
' Exit Sub
' End If
If txtScmo1 = "" And txtScres2 = "" Then
MsgBox "Please Enter Either Of The Phone Numbers.", vbOKOnly, "Chate
Coaching Classes "
Exit Sub
txtSfname.SetFocus
End If

Dim rsSave As ADODB.Recordset


Dim sql As String
If UserMode = "ADD" Then
sql = "Select * from Student"
Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew
rsSave("StudentId") = txtSid
rsSave("DateOfAdmission") = DTPickerSD
rsSave("RollNo") = txtRollNo
rsSave("StudentName") = txtSfname
' rsSave("CourseName") = cboCoursename

' rsSave("BatchId") = cboBatchid


rsSave("Sex") = Sex
rsSave("MobileNo") = Val(txtScmo1)

61
Chate Coaching Classes [Borivali Branch]

rsSave("ResidenceNo") = Val(txtScres2)
rsSave("GuardiansName") = txtGname
rsSave("GuardiansNo") = Val(txtGcontactno)
rsSave("Address") = txtSa1
rsSave.Update
DTPickerSD.Value = Date
rsSave.Close
ElseIf UserMode = "UPDATE" Then
sql = "Select * from Student where StudentId=" & Val(txtSid)
Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave("StudentName") = txtSfname
rsSave("DateOfAdmission") = DTPickerSD
rsSave("StudentName") = txtSfname
' rsSave("CourseName") = cboCoursename
'rsSave("BatchId") = cboBatchid
rsSave("Sex") = Sex
rsSave("MobileNo") = txtScmo1
rsSave("ResidenceNo") = txtScres2
rsSave("GuardiansName") = txtGname
rsSave("GuardiansNo") = txtGcontactno
rsSave("Address") = txtSa1
rsSave.Update
DTPickerSD.Value = Date
rsSave.Close
End If

Dim rsSave1 As ADODB.Recordset


Dim rsSave2 As ADODB.Recordset

Dim sql1, sql2 As String


If UserMode = "ADD" Then
sql1 = "Select * from CourseEnrolled"
Set rsSave1 = New ADODB.Recordset
rsSave1.Open sql1, Conn, adOpenKeyset, adLockOptimistic
rsSave1.AddNew
rsSave1("StudentId") = txtSid
' rsSave1("CourseName") = cboCname
sql2 = "Select BatchId from BatchMaster where BatchName= '" & Trim(cboBid) & "'"
Set rsSave2 = New ADODB.Recordset
rsSave2.Open sql2, Conn, adOpenKeyset, adLockOptimistic

rsSave1("BatchId") = rsSave2("BatchId")
rsSave2.Close
rsSave1.Update

62
Chate Coaching Classes [Borivali Branch]

DTPickerSD.Value = Date
rsSave1.Close
ElseIf UserMode = "UPDATE" Then
sql1 = "Select * from CourseEnrolled where StudentId=" & Val(txtSid)
Set rsSave1 = New ADODB.Recordset
rsSave1.Open sql1, Conn, adOpenKeyset, adLockOptimistic
' rsSave1("CourseName") = cboCname

sql2 = "Select BatchId from BatchMaster where BatchName= '" & Trim(cboBid) & "'"

Set rsSave2 = New ADODB.Recordset


rsSave2.Open sql2, Conn, adOpenKeyset, adLockOptimistic

rsSave1("BatchId") = rsSave2("BatchId")
rsSave2.Close

rsSave1.Update
DTPickerSD.Value = Date
rsSave1.Close
End If
fillList
UserMode = ""
cmdSdAdd.Enabled = True
cmdSdUpdate.Enabled = False
cmdSdDelete.Enabled = False
cmdSdSearch.Enabled = True
cmdPayment.Enabled = True
cmdSdSave.Enabled = False
cmdsdCancel.Caption = "Exit"
cmdsdCancel.Enabled = True
End Sub

Private Sub cmdSdSearch_Click()


txtRollNo.Enabled = True
frmSearchstudent.SetFocus
End Sub
Private Sub cmdSdUpdate_Click()
UserMode = "UPDATE"
cmdSdAdd.Enabled = False
cmdSdDelete.Enabled = False
cmdsdCancel.Caption = "Cancel"
cmdSdSave.Enabled = True

End Sub

Private Sub Form_Load()

63
Chate Coaching Classes [Borivali Branch]

'Disabledfillings
cmdSdAdd.Enabled = True
cmdSdUpdate.Enabled = False
cmdSdDelete.Enabled = False
cmdSdSearch.Enabled = True
cmdPayment.Enabled = True
cmdsdCancel.Enabled = True
cmdSdSave.Enabled = False
Set rs = New ADODB.Recordset
rs.Open "select *from Student", Conn, adOpenDynamic, adLockOptimistic
fillList
fillCoursecombo
Set rs = Nothing
DTPickerSD.Value = Date
End Sub

Private Sub lstStudDetails_Click()


If lstStudDetails.ListItems.Count = 0 Then
MsgBox "NO Records", vbOKOnly, "Chate Coaching Classes"
Else
cboCname.ListIndex = -1
cboBid.ListIndex = -1

txtSid = lstStudDetails.SelectedItem
txtRollNo = lstStudDetails.SelectedItem.SubItems(2)
'date of admission
txtSfname = lstStudDetails.SelectedItem.SubItems(3)
Sex = lstStudDetails.SelectedItem.SubItems(4)
If Sex = "M" Then
optMale.Value = True
Else
optFemale.Value = True
End If
txtScmo1 = lstStudDetails.SelectedItem.SubItems(5)
txtScres2 = lstStudDetails.SelectedItem.SubItems(6)

txtGname = lstStudDetails.SelectedItem.SubItems(7)
txtGcontactno = lstStudDetails.SelectedItem.SubItems(8)
txtSa1 = lstStudDetails.SelectedItem.SubItems(9)
'DTPickerSD = lstStudDetails.SelectedItem.SubItems(10)
'cboCName = lstStudDetails.SelectedItem.SubItems(11)
' cboBid = lstStudDetails.SelectedItem.SubItems(11)
Set rsenroll = New ADODB.Recordset
'If Not rsenroll.EOF = True Then
rsenroll.Open "select * from CourseEnrolled,BatchMaster,courseMaster where
BatchMaster.CourseId=courseMaster.courseId and

64
Chate Coaching Classes [Borivali Branch]

CourseEnrolled.BatchId=BatchMaster.BatchId and CourseEnrolled.StudentId=" &


txtSid, Conn, adOpenDynamic, adLockOptimistic
'If Not rsenroll.EOF = True Then
If Not rsenroll.Fields("courseName") = "" Then
cboCname = rsenroll.Fields("courseName")
End If
fillBatch (cboCname.ItemData(cboCname.ListIndex))
If Not rsenroll.Fields("BatchName") = "" Then
cboBid = rsenroll.Fields("BatchName")
End If
End If
' rsenroll.Close
cmdSdAdd.Enabled = False
cmdSdSearch.Enabled = False
cmdSdUpdate.Enabled = True
cmdSdDelete.Enabled = True
cmdsdCancel.Caption = "Cancel"
cmdsdCancel.Enabled = True
cmdPayment.Enabled = False
Enabledfillings
'End If
End Sub

Private Sub txtCity_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub optFemale_Click()


If optFemale.Value = True Then
Sex = "F"
End If
End Sub

Private Sub optMale_Click()


If optMale.Value = True Then
Sex = "M"
End If
End Sub

Private Sub txtGcontactno_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtGname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

65
Chate Coaching Classes [Borivali Branch]

Private Sub txtPincode_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtSc1_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub txtSc2_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRollNo_Validate(Cancel As Boolean)


Dim rsEDIT, rsenroll As ADODB.Recordset
Dim sql As String

sql = "Select * from Student where Rollno='" & Trim(txtRollNo) & "'"

Set rsEDIT = New ADODB.Recordset


rsEDIT.Open sql, Conn, adOpenKeyset, adLockOptimistic
If Not rsEDIT.EOF Then
' txtSid = rsEDIT.Fields(0)
'txtRollNo = rsEDIT.Fields(1)
txtSfname = rsEDIT.Fields(3)
Sex = rsEDIT.Fields(4)
'MsgBox Sex
If Sex = "M" Then
optMale.Value = True
Else
optFemale.Value = True
End If

txtScmo1 = rsEDIT.Fields(5)
txtScres2 = rsEDIT.Fields(6)
txtGname = rsEDIT.Fields(7)
txtGcontactno = rsEDIT.Fields(8)

txtSa1 = rsEDIT.Fields(9)
End If

Set rsenroll = New ADODB.Recordset

rsenroll.Open "select * from CourseEnrolled,BatchMaster,courseMaster where


BatchMaster.CourseId=courseMaster.courseId and
CourseEnrolled.BatchId=BatchMaster.BatchId and CourseEnrolled.StudentId= " &
txtSid, Conn, adOpenDynamic, adLockOptimistic
If Not rsenroll.EOF Then

66
Chate Coaching Classes [Borivali Branch]

cboCname = rsenroll.Fields("courseName")
fillBatch (cboCname.ItemData(cboCname.ListIndex))
cboBid = rsenroll.Fields("BatchName")
'rsenroll.Close
End If
Enabledfillings

cmdsdCancel.Enabled = True
cmdsdCancel.Caption = "Cancel"
End Sub

Private Sub txtScmo1_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtScres2_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub ControlsEnabled()
cmdSdAdd.Enabled = True
cmdSdSearch.Enabled = True
End Sub
Private Sub fillCoursecombo()
Dim i As Integer
i=0
Set rs = New ADODB.Recordset
rs.Open "Select * from courseMaster", Conn, adOpenKeyset, adLockBatchOptimistic
While Not rs.EOF
cboCname.AddItem rs.Fields("CourseName"), i
cboCname.ItemData(i) = rs.Fields("CourseId")
i=i+1
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
End Sub

Private Sub fillBatch(searchval)


Dim sql As String
Dim i As Integer

'sql = "Select * from BatchMaster,courseMaster where


courseMaster.courseId=BatchMaster.courseId and BatchMaster.BatchId=" &
Val(searchval) & ""
cboBid.Clear

67
Chate Coaching Classes [Borivali Branch]

i=0
sql = "SELECT b.BatchId, b.BatchName " & _
" FROM BatchMaster b, courseMaster c " & _
" WHERE B.CourseId = C.courseId AND " & _
" C.courseid=" & searchval
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
While Not rs.EOF
cboBid.AddItem rs.Fields("BatchName"), i
cboBid.ItemData(i) = rs.Fields("BatchId")
i=i+1
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
End Sub

Private Sub Enabledfillings()


'txtSid .Enabled = True
txtRollNo.Enabled = True
txtSfname.Enabled = True
optMale.Enabled = True
optFemale.Enabled = True
txtScmo1.Enabled = True
txtScres2.Enabled = True
txtGname.Enabled = True
txtGcontactno.Enabled = True
txtSa1.Enabled = True
cboCname.Enabled = True
cboBid.Enabled = True

End Sub

Private Sub txtSfname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

5.1.6 Search Student Form:

Option Explicit

68
Chate Coaching Classes [Borivali Branch]

Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim list As ListItem
Dim List1 As ListItem
Dim UserMode As String
Private Sub fillList()
'Set rs = New ADODB.Recordset
'Set rs1 = New ADODB.Recordset
'rs.Open "Select * from Student", Conn, adOpenKeyset, adLockOptimistic
'rs1.Open "Select * from PaymentRecord", Conn, adOpenKeyset, adLockOptimistic

lstSStudDetails.ListItems.Clear
While rs.EOF <> True
Set list = lstSStudDetails.ListItems.Add(, , Trim(rs("Student.StudentId") & ""))

list.SubItems(1) = Trim(rs("RollNo") & "")

' list.SubItems(2) = Trim(rs("BatchName") & "")


list.SubItems(3) = Trim(rs("StudentName") & "")
list.SubItems(4) = Trim(rs("DateOfAdmission") & "")
' list1.SubItems(5) = Trim(rs("TotalAmtPaid") & "")
rs.MoveNext
'rs1.MoveNext
Wend
'Wend
'Balance
End Sub

Private Sub cboSsBatchName_Change()


'lstSStudDetails.Enabled = True
End Sub

Private Sub cboSsRollNo_Click()


'lstSStudDetails.Enabled = True
End Sub

Private Sub Command1_Click()


Dim str2, str
str2 = " and"
If cboSsSid.Text <> "" Then
str2 = str2 & " StudentId=" & cboSsSid & " and"
End If
If cboSsRollNo <> "" Then
str2 = str2 & " RollNo='" & cboSsRollNo & "' and"

69
Chate Coaching Classes [Borivali Branch]

End If
If cboSsBatchName <> "" Then
str2 = str2 & " BatchMaster.BatchName='" & cboSsBatchName & "' and"
End If

If txtSsSfname <> "" Then


str2 = str2 & " StudentName='" & txtSsSfname & "' and"
End If

'Balance

str = "select * from Student,CourseEnrolled,BatchMaster where


Student.StudentId=CourseEnrolled.StudentId and
CourseEnrolled.BatchId=BatchMaster.BatchId " & Left(str2, Len(str2) - 4)
'MsgBox str
Set rs = New ADODB.Recordset
'Set rs1 = New ADODB.Recordset
rs.Open str, Conn, adOpenDynamic, adLockOptimistic
' rs1.Open str, Conn, adOpenDynamic, adLockOptimistic

fillList
Set rs = Nothing

'Set rs1 = Nothing


'MsgBox str
'lstSStudDetails.Enabled = True
End Sub

Private Sub cmdBack_Click()


frmStudentDetails.SetFocus
If cboSsRollNo.Text <> "" Then
frmStudentDetails.txtSid = lstSStudDetails.SelectedItem
frmStudentDetails.txtRollNo = lstSStudDetails.SelectedItem.SubItems(1)
frmStudentDetails.txtRollNo.SetFocus
End If
End Sub

Private Sub DTPickerSSD_Click()


DTPickerSSD.Value = Date
End Sub

Private Sub DTPickerSSD_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

70
Chate Coaching Classes [Borivali Branch]

Private Sub Form_Load()


DTPickerSSD.Value = Date
Set rs = New ADODB.Recordset
rs.Open "select *from Student", Conn, adOpenDynamic, adLockOptimistic

fillBatchcombo
fillRollNocombo
fillIdcombo

' lstSStudDetails.Enabled = False


Set rs = Nothing
End Sub

Private Sub lstSStudDetails_Click()


cmdBack.Enabled = True
If lstSStudDetails.SelectedItem Is Nothing Then
MsgBox "No Records", vbOKOnly, "Chate Coaching Classes"
Else
cboSsSid = lstSStudDetails.SelectedItem
cboSsRollNo = lstSStudDetails.SelectedItem.SubItems(1)

' cboSsBatchName = lstSStudDetails.SelectedItem.SubItems(2)


DTPickerSSD = lstSStudDetails.SelectedItem.SubItems(4)
txtSsSfname = lstSStudDetails.SelectedItem.SubItems(3)
txtSsSfname.Enabled = True
End If
End Sub

Private Sub fillIdcombo()

Set rs = New ADODB.Recordset


rs.Open "Select StudentId from Student", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboSsSid.AddItem (rs.Fields("StudentId"))
rs.MoveNext
Wend
End Sub
Private Sub fillRollNocombo()

Set rs = New ADODB.Recordset


rs.Open "Select RollNo from Student", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboSsRollNo.AddItem (rs.Fields("RollNo"))
rs.MoveNext
Wend

71
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub ClearAll()

cboSsSid.ListIndex = -1
cboSsRollNo.ListIndex = -1
cboSsBatchName.ListIndex = -1
txtSsSfname = ""
End Sub

Private Sub cmdOK_Click()


ClearAll
lstSStudDetails.ListItems.Clear
End Sub

Private Sub fillBatchcombo()

Set rs = New ADODB.Recordset


rs.Open "Select BatchName from BatchMaster", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboSsBatchName.AddItem (rs.Fields("BatchName"))
rs.MoveNext
Wend
End Sub

5.1.7 Student Payment Form:

Option Explicit
Dim rsenroll As ADODB.Recordset
Dim rs As ADODB.Recordset
Dim List1 As ListItem
Dim UserMode, ModeOfPayment As String

Private Sub cboSid_Change()

End Sub

Private Sub cboSrn_Click()


fillPayList (cboSrn)

End Sub

Private Sub cmdReceipt_Click()


frmFeeReceipt.SetFocus

72
Chate Coaching Classes [Borivali Branch]

If txtRollNo <> "" Then


frmFeeReceipt.txtRollNo = lstPayment.SelectedItem.SubItems(1)
End If
txtAmountrec = ""
txtChequeno = ""
txtBankname = ""
txtReceiptno = ""
cboSrn.Clear
txtBalance = ""
txtCourseFees = ""
txtRollNo = ""
txtSid = ""
txtTotalRec = ""
lstPayment.ListItems.Clear
End Sub

Private Sub cmdSdAdd_Click()

DTPickerDate.Value = Date
txtReceiptno = Val(getMaxNo("PaymentRecord", "ReceiptNo")) + 1
txtAmountrec = ""
txtChequeno = ""
txtBankname = ""
optCash.Value = False
optCheque.Value = False
cmdSdSave.Enabled = True
cmdsdCancel.Caption = "Cancel"
cmdsdCancel.Enabled = True
cmdSdUpdate.Enabled = False
cmdSdDelete.Enabled = False
fill
UserMode = "ADD"
End Sub

Private Sub cmdsdCancel_Click()


If cmdsdCancel.Caption = "Exit" Then
Unload Me
Exit Sub
End If
cmdsdCancel.Caption = "Exit"
cmdsdCancel.Enabled = True
cmdSdAdd.Enabled = False
cmdReceipt.Enabled = False
cmdSdUpdate.Enabled = False
cmdSdSave.Enabled = False
cmdSdDelete.Enabled = False

73
Chate Coaching Classes [Borivali Branch]

txtAmountrec = ""
txtBalance = ""
txtBankname = ""
txtChequeno = ""
txtCourseFees = ""
txtReceiptno = ""
txtRollNo = ""
txtSid = ""
End Sub
Private Sub fillPayList(searchval)
Dim sql As String
Dim totalfee, Coursefee, balfee As Double
totalfee = 0
sql = "Select * from PaymentRecord,Student where
PaymentRecord.StudentId=Student.StudentId and Student.Rollno='" & Trim(searchval)
& "'"
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
lstPayment.ListItems.Clear
While rs.EOF <> True
Set List1 = lstPayment.ListItems.Add(, , Trim(rs("Student.StudentId") & ""))
List1.SubItems(1) = Trim(rs("RollNo") & "")
List1.SubItems(2) = Trim(rs("ModeOfPayment") & "")
List1.SubItems(3) = Trim(rs("BankName") & "")
List1.SubItems(4) = Trim(rs("ChequeNo") & "")
List1.SubItems(5) = Trim(rs("DateOfPayment") & "")
List1.SubItems(6) = Trim(rs("AmountReceived") & "")
List1.SubItems(7) = Trim(rs("ReceiptNo") & "")
List1.SubItems(8) = Trim(rs("TotalAmtPaid") & "")
totalfee = totalfee + rs("AmountReceived")
rs.MoveNext
Wend
Set rsenroll = New ADODB.Recordset
rsenroll.Open "select * from CourseEnrolled,BatchMaster,courseMaster where
BatchMaster.CourseId=courseMaster.courseId and
CourseEnrolled.BatchId=BatchMaster.BatchId and CourseEnrolled.StudentId=" &
Mid(searchval, 3, Len(searchval)), Conn, adOpenDynamic, adLockOptimistic
Coursefee = rsenroll.Fields("courseFees")
rsenroll.Close
txtBalance = Coursefee - totalfee
txtCourseFees = Coursefee
txtTotalRec = totalfee
'sql = "Select * from CouStudent where PaymentRecord.StudentId=Student.StudentId
and Student.Rollno='" & Trim(searchval) & "'"
'Set rs = New ADODB.Recordset
'rs.Open sql, Conn, adOpenKeyset, adLockOptimistic

74
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub cmdSdDelete_Click()


Dim sql1 As String
If vbYes = MsgBox("Are you sure you want to delete this record?", vbYesNo +
vbQuestion, "CHATE COACHING CLASSES") Then
sql1 = "Select * from PaymentRecord where StudentId=" & Val(txtSid)
Set rs = New ADODB.Recordset
rs.Open sql1, Conn, adOpenKeyset, adLockOptimistic
If rs.EOF And Not rs.BOF Then
MsgBox "No records to delete"
Else
rs.Delete
rs.MoveNext
rs.Close
fillPayList (txtRollNo)
txtSid = ""
optCash.Value = False
optCheque.Value = False
txtBankname = ""
txtChequeno = ""
'dateof payment
txtAmountrec = ""
txtReceiptno = ""
' TotalAmtPaid

Exit Sub
End If
cmdSdUpdate.Enabled = False
cmdsdCancel.Enabled = False
End Sub

Private Sub cmdSdUpdate_Click()


UserMode = "UPDATE"
cmdSdAdd.Enabled = False
cmdSdDelete.Enabled = False
cmdSdSave.Enabled = True
cmdsdCancel.Caption = "Cancel"
cmdsdCancel.Enabled = True
End Sub

Private Sub cmdSr_Click()


If cboSrn <> "" Then
Dim str2, str
str2 = "where"

75
Chate Coaching Classes [Borivali Branch]

If cboSrn.Text <> "" Then


str2 = str2 & " RollNo='" & cboSrn & "' and"
'str2 = str2 & " StudentId=" & cboSrn & " and"
End If

str = "select RollNo from Student " & Left(str2, Len(str2) - 4)


'str = "select * from PaymentRecord " & Left(str2, Len(str2) - 4)

Set rs = New ADODB.Recordset


rs.Open str, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
txtRollNo = cboSrn
txtSid = Mid(cboSrn, 3, Len(cboSrn) - 2)
End If
fillPayList (txtRollNo)

Set rs = Nothing
End If
End Sub
Private Sub DTPickerDate_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub Form_Load()


Set rs = New ADODB.Recordset
rs.Open "select *from PaymentRecord", Conn, adOpenDynamic, adLockOptimistic

fillRollNocombo
Set rs = Nothing

DTPickerDate.Value = Date
cmdSdAdd.Enabled = False
cmdReceipt.Enabled = False
cmdSdUpdate.Enabled = False
cmdSdSave.Enabled = False
cmdsdCancel.Enabled = True
cmdSdDelete.Enabled = False
End Sub

Private Sub lstPayment_Click()


fill
If lstPayment.ListItems.Count = 0 Then
MsgBox "NO Records", vbOKOnly, "Chate Coaching Classes"
Else
txtSid = lstPayment.SelectedItem
txtRollNo = lstPayment.SelectedItem.SubItems(1)

76
Chate Coaching Classes [Borivali Branch]

ModeOfPayment = lstPayment.SelectedItem.SubItems(2)
If ModeOfPayment = "Cash" Then
optCash.Value = True
Else
optCheque.Value = True
End If

txtBankname = lstPayment.SelectedItem.SubItems(3)
txtChequeno = lstPayment.SelectedItem.SubItems(4)
' DateOfPayment = lstPayment.SelectedItem.SubItems(5)
txtAmountrec = lstPayment.SelectedItem.SubItems(6)
txtReceiptno = lstPayment.SelectedItem.SubItems(7)
' TotalAmtPaid = lstPayment.SelectedItem.SubItems(8)

cmdSdUpdate.Enabled = True
cmdSdDelete.Enabled = True
cmdSdAdd.Enabled = False
cmdReceipt.Enabled = True
cmdsdCancel.Caption = "Cancel"
cmdsdCancel.Enabled = True
End If
End Sub
Private Sub optCash_Click()
If optCash.Value = True Then
ModeOfPayment = "Cash"
End If

If optCash.Value = True Then


lblChequeno.Enabled = False
txtChequeno.Enabled = False
lblBankname.Enabled = False
txtBankname.Enabled = False
End If
End Sub

Private Sub optCheque_Click()


If optCheque.Value = True Then
ModeOfPayment = "Cheque"
End If

If optCheque.Value = True Then


txtChequeno.Enabled = True
lblChequeno.Enabled = True
lblBankname.Enabled = True
txtBankname.Enabled = True
End If

77
Chate Coaching Classes [Borivali Branch]

End Sub
Private Sub txtAmountrec_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtBankname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub txtChequeno_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub txtReceiptno_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRollNo_GotFocus()


If txtRollNo <> "" Then
cmdSdAdd.Enabled = True
'cmdsdCancel.Enabled = True
End If
End Sub

Private Sub txtRollNo_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRollNo_Validate(Cancel As Boolean)


fillPayList (txtRollNo)

End Sub

Private Sub txtSfname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub
Private Sub txtSid_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub ControlsEnabled()
cmdSdAdd.Enabled = True
cmdSdUpdate.Enabled = True
cmdSdDelete.Enabled = True

End Sub
Private Sub cmdSdSave_Click()
If txtAmountrec = "" Then

78
Chate Coaching Classes [Borivali Branch]

MsgBox "Enter Fees Being Received.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
txtAmountrec.SetFocus
End If
'If txtTotalRec > txtCoursefees Then
If txtAmountrec > txtBalance Then
MsgBox "Extra Fees is Being Taken.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
cboSrn.SetFocus
End If
Dim rsSave1 As ADODB.Recordset
Dim sql1 As String

If UserMode = "ADD" Then


sql1 = "Select * from PaymentRecord"
Set rsSave1 = New ADODB.Recordset
rsSave1.Open sql1, Conn, adOpenKeyset, adLockOptimistic
rsSave1.AddNew
rsSave1("StudentId") = txtSid
'rsSave1("RollNo") = txtRollNo
rsSave1("BankName") = txtBankname
rsSave1("ChequeNo") = Val(txtChequeno)
rsSave1("DateOfPayment") = DTPickerDate
rsSave1("AmountReceived") = txtAmountrec
rsSave1("ReceiptNo") = txtReceiptno
'rsSave1("TotalAmtPaid") = TotalAmtPaid
rsSave1("ModeOfPayment") = ModeOfPayment
rsSave1.Update
DTPickerDate.Value = Date
rsSave1.Close

ElseIf UserMode = "UPDATE" Then


sql1 = "Select * from PaymentRecord where ReceiptNo=" & Val(txtReceiptno)
Set rsSave1 = New ADODB.Recordset
rsSave1.Open sql1, Conn, adOpenKeyset, adLockOptimistic
rsSave1("StudentId") = txtSid
rsSave1("BankName") = txtBankname
rsSave1("ChequeNo") = Val(txtChequeno)
rsSave1("DateOfPayment") = DTPickerDate
rsSave1("AmountReceived") = txtAmountrec
rsSave1("ReceiptNo") = txtReceiptno
'rsSave1("TotalAmtPaid") = TotalAmtPaid
rsSave1("ModeOfPayment") = ModeOfPayment
rsSave1.Update
DTPickerDate.Value = Date

79
Chate Coaching Classes [Borivali Branch]

rsSave1.Close
End If
cmdSdDelete.Enabled = True
cmdSdAdd.Enabled = True
UserMode = ""
Call fillPayList(txtRollNo)
cmdSdAdd.Enabled = True
cmdReceipt.Enabled = False
cmdSdUpdate.Enabled = False
cmdSdSave.Enabled = False
cmdsdCancel.Enabled = True
cmdSdDelete.Enabled = False
txtAmountrec = ""
txtBalance = ""
txtBankname = ""
txtChequeno = ""
txtCourseFees = ""
txtReceiptno = ""
txtRollNo = ""
txtSid = ""
End Sub

Private Sub fillRollNocombo()

Set rs = New ADODB.Recordset


rs.Open "Select RollNo from Student", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboSrn.AddItem (rs.Fields("RollNo"))
rs.MoveNext
Wend
End Sub

Private Sub fill()

txtAmountrec.Enabled = True
txtBankname.Enabled = True
txtChequeno.Enabled = True
End Sub

5.1.8 Fee-Receipt Form:

Option Explicit

Private Sub cmdFrecCancel_Click()

80
Chate Coaching Classes [Borivali Branch]

txtAmt = ""
txtTotalCourseFees = ""
txtRBankname = ""
txtRChequeno = ""
txtRCoursefees = ""
txtRollNo = ""
txtRReceiptno = ""
txtRSname = ""
txtCName = ""
txtRBatchid = ""
txtSid = ""
End Sub

Private Sub cmdFrecPrint_Click()


frmCallFeeReceipt.Show
End Sub

Private Sub Form_Load()


DTPicker1.Value = Date
End Sub

Private Sub lblRContno_Click()

End Sub

Private Sub optCash_Click()


If optCash.Value = True Then
lblRChequeno.Enabled = False
txtRChequeno.Enabled = False
lblRBankname.Enabled = False
txtRBankname.Enabled = False
End If
End Sub

Private Sub optCheque_Click()


If optCheque.Value = True Then
lblRChequeno.Enabled = True
txtRChequeno.Enabled = True
lblRBankname.Enabled = True
txtRBankname.Enabled = True
End If
End Sub

Private Sub txtAmt_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)

81
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub txtTotalCourseFees_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRBankname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub txtRChequebounceamt_KeyPress(Index As Integer, KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRChequeno_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRCoursefees_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRollNo_Validate(Cancel As Boolean)


Dim rsEDIT As ADODB.Recordset
Dim sql As String

' sql = "Select * from PaymentRecord where StudentId=" & Val(txtSid) & ""

sql3 = "Select * from PaymentRecord,Student where


PaymentRecord.StudentId=Student.StudentId and Student.Rollno='" & Trim(txtRollNo)
& "'"
Set rsEDIT = New ADODB.Recordset
rsEDIT.Open sql3, Conn, adOpenKeyset, adLockOptimistic
If Not rsEDIT.EOF Then
txtSid = rsEDIT.Fields(0)
ModeOfPayment = rsEDIT.Fields(1)
If ModeOfPayment = "Cash" Then
optCash.Value = True
Else
optCheque.Value = True
End If
If (rsEDIT.Fields(2)) <> "Null" Then
txtRBankname = (rsEDIT.Fields(2))
End If
txtRChequeno = rsEDIT.Fields(3)
' DateOfPayment = rsEDIT.Fields(4)

82
Chate Coaching Classes [Borivali Branch]

txtAmt = rsEDIT.Fields(5)
txtRReceiptno = rsEDIT.Fields(6)
'TotalAmtPaid = rsEDIT.Fields(7)
'txtRSname = rsEDIT1.Fields(8)
sql = "select CourseName,BatchName,courseFees from courseMaster,BatchMaster,
CourseEnrolled where CourseEnrolled.BatchId=BatchMaster.BatchId and
BatchMaster.CourseId=courseMaster.CourseId and CourseEnrolled.StudentId=" & txtSid
rsEDIT.Close
Set rsEDIT = New ADODB.Recordset
rsEDIT.Open sql, Conn, adOpenKeyset, adLockOptimistic
If Not rsEDIT.EOF Then
txtCName = rsEDIT.Fields(0)
txtRBatchid = rsEDIT.Fields(1)
txtTotalCourseFees = rsEDIT.Fields(2)

End If
rsEDIT.Close

Dim rsEDIT1 As ADODB.Recordset


Dim sql4 As String

sql4 = "Select StudentName from Student where StudentId=" & Val(txtSid) & ""

Set rsEDIT1 = New ADODB.Recordset


rsEDIT1.Open sql4, Conn, adOpenKeyset, adLockOptimistic
If Not rsEDIT1.EOF Then
txtRSname = rsEDIT1.Fields(("StudentName"))
End If

End If

txtAmt.Enabled = True
optCash.Enabled = True
optCheque.Enabled = True
txtCName.Enabled = True
txtRBankname.Enabled = True
txtRBatchid.Enabled = True
txtRChequeno.Enabled = True
txtRReceiptno.Enabled = True
txtRSname.Enabled = True
txtTotalCourseFees.Enabled = True
End Sub

Private Sub txtRReceiptno_KeyPress(KeyAscii As Integer)

83
Chate Coaching Classes [Borivali Branch]

KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRRollNo_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRRollNo_Validate(Cancel As Boolean)

End Sub

Private Sub txtRSc1_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtRSname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

4.5.2 Faculty Details Form:

Option Explicit
Dim rs As ADODB.Recordset
Dim list As ListItem
Dim UserMode As String

Private Sub fillList()

Set rs = New ADODB.Recordset


rs.Open "Select * from Faculty", Conn, adOpenKeyset, adLockOptimistic
lstFacultydetails.ListItems.Clear
While rs.EOF <> True
Set list = lstFacultydetails.ListItems.Add(, , Trim(rs("FacultyId") & ""))
list.SubItems(1) = Trim(rs("FacultyName") & "")
list.SubItems(2) = Trim(rs("CourseName") & "")
list.SubItems(3) = Trim(rs("SubjectName1") & "")
list.SubItems(4) = Trim(rs("SubjectName2") & "")
list.SubItems(5) = Trim(rs("MobileNo") & "")
list.SubItems(6) = Trim(rs("ResidenceNo") & "")
list.SubItems(7) = Trim(rs("Address") & "")
list.SubItems(8) = Trim(rs("DateOfJoining") & "")
rs.MoveNext
Wend

84
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub cboFdSub_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub cmdcancel_Click()


lstFacultydetails.Enabled = False
If cmdCancel.Caption = "Exit" Then
Unload Me
Exit Sub
End If

cmdCancel.Caption = "Exit"

cmdFdAdd.Enabled = True
cmdFdUpdate.Enabled = False
cmdFdDelete.Enabled = False
cmdfSearch.Enabled = True
cmdCancel.Enabled = True
cmdFdSave.Enabled = False

txtFacid = ""
txtFn = ""
cboFdCoursename.ListIndex = -1
cboFdSub1.ListIndex = -1
cboFdSub2.ListIndex = -1
txtFmobno = ""
txtFResNo = ""
txtFaddress1 = ""

End Sub

Private Sub cmdConfirmation_Click()


frmAppointment.SetFocus
End Sub

Private Sub cmdFdAdd_Click()


cmdFdAdd.Enabled = False
cmdFdDelete.Enabled = False
cmdFdUpdate.Enabled = False
cmdCancel.Enabled = True
cmdCancel.Caption = "Cancel"
cmdFdSave.Enabled = True
cmdfSearch.Enabled = False
EnabledC

85
Chate Coaching Classes [Borivali Branch]

lstFacultydetails.Enabled = False
UserMode = "ADD"
DTPickerFD.Value = Date
txtFacid = Val(getMaxNo("Faculty", "FacultyId")) + 1
txtFn = ""
cboFdCoursename.ListIndex = -1
cboFdSub1.ListIndex = -1
cboFdSub2.ListIndex = -1
txtFmobno = ""
txtFResNo = ""
txtFaddress1 = ""
End Sub

Private Sub cmdFdDelete_Click()


Dim sql As String
If vbYes = MsgBox("Are you sure you want to delete this record?", vbYesNo +
vbQuestion, "CHATE COACHING CLASSES") Then
sql = "Select * from Faculty where FacultyId=" & Val(txtFacid)
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
If rs.EOF And Not rs.BOF Then
MsgBox "No records to delete"
' Else
' rs.Delete
' rs.Close
End If
rs.Delete
rs.MoveNext
rs.Close
fillList
Clear
Exit Sub
End If

cmdFdAdd.Enabled = True
cmdFdUpdate.Enabled = False
cmdFdDelete.Enabled = False
cmdfSearch.Enabled = True
cmdFdSave.Enabled = False
cmdCancel.Caption = "Cancel"
cmdCancel.Enabled = True
End Sub

Private Sub cmdFdSave_Click()


lstFacultydetails.Enabled = False
If txtFn = "" Then

86
Chate Coaching Classes [Borivali Branch]

MsgBox "Please Enter Faculty's Name.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
txtFn.SetFocus
End If
If cboFdCoursename = "" Then
MsgBox "Please Enter Course Name.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
cboFdCoursename.SetFocus
End If
If cboFdSub1 = "" And cboFdSub2 = "" Then
MsgBox "Please Enter Subject Name.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
If txtFmobno = "" And txtFResNo = "" Then
MsgBox "Please Enter Faculty's Number.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
If txtFaddress1 = "" Then
MsgBox "Please Enter Faculty's Address.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
txtFaddress1.SetFocus
End If
Dim rsSave As ADODB.Recordset
Dim sql As String
If UserMode = "ADD" Then

sql = "Select * from Faculty "


Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew

rsSave("FacultyId") = txtFacid
rsSave("FacultyName") = txtFn
rsSave("CourseName") = cboFdCoursename
rsSave("SubjectName1") = cboFdSub1
rsSave("SubjectName2") = cboFdSub2
rsSave("MobileNo") = Val(txtFmobno)
rsSave("ResidenceNo") = Val(txtFResNo)
rsSave("Address") = txtFaddress1
rsSave("DateOfJoining") = DTPickerFD
rsSave.Update
DTPickerFD.Value = Date
rsSave.Close

ElseIf UserMode = "UPDATE" Then


sql = "Select * from Faculty where FacultyId=" & Val(txtFacid)

87
Chate Coaching Classes [Borivali Branch]

Set rsSave = New ADODB.Recordset


rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave("FacultyName") = txtFn
rsSave("CourseName") = cboFdCoursename
rsSave("SubjectName1") = cboFdSub1
rsSave("SubjectName2") = cboFdSub2
rsSave("MobileNo") = Val(txtFmobno)
rsSave("ResidenceNo") = Val(txtFResNo)
rsSave("Address") = txtFaddress1
rsSave("DateOfJoining") = DTPickerFD
rsSave.Update
DTPickerFD.Value = Date
rsSave.Close
End If
cmdFdAdd.Enabled = True
cmdFdUpdate.Enabled = False
cmdFdDelete.Enabled = False
cmdfSearch.Enabled = True
cmdFdSave.Enabled = False
cmdCancel.Caption = "Exit"
cmdCancel.Enabled = True
fillList
Clear
UserMode = ""
End Sub
Private Sub cmdFdUpdate_Click()
UserMode = "UPDATE"
cmdFdAdd.Enabled = False
cmdFdDelete.Enabled = False
cmdfSearch.Enabled = False
cmdFdSave.Enabled = True
cmdCancel.Enabled = True
cmdCancel.Caption = "Cancel"
End Sub

Private Sub cmdfSearch_Click()


txtFacid.Enabled = True
frmSearchFaculty.SetFocus
End Sub

Private Sub DTPickerFD_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub Form_Load()


cmdFdAdd.Enabled = True

88
Chate Coaching Classes [Borivali Branch]

cmdFdUpdate.Enabled = False
cmdFdDelete.Enabled = False
cmdfSearch.Enabled = True
cmdCancel.Enabled = True
cmdFdSave.Enabled = False

Set rs = New ADODB.Recordset


rs.Open "select * from Faculty", Conn, adOpenDynamic, adLockOptimistic
fillcombo
fillSubjectcombo
fillList
Set rs = Nothing

'DTPickerFD.Value = Date
End Sub
Private Sub fillcombo()

Set rs = New ADODB.Recordset


rs.Open "Select CourseName from courseMaster", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboFdCoursename.AddItem (rs.Fields("CourseName"))
rs.MoveNext
Wend
End Sub

Private Sub txtCoursename_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub lstFacultydetails_Click()


If lstFacultydetails.ListItems.Count = 0 Then
MsgBox "No Records"
Else
cboFdSub2.ListIndex = -1
cboFdSub2.ListIndex = -1
txtFacid = lstFacultydetails.SelectedItem
txtFn = lstFacultydetails.SelectedItem.SubItems(1)

cboFdCoursename = lstFacultydetails.SelectedItem.SubItems(2)
If Not lstFacultydetails.SelectedItem.SubItems(3) = "" Then
cboFdSub1 = lstFacultydetails.SelectedItem.SubItems(3)
End If
If Not lstFacultydetails.SelectedItem.SubItems(4) = "" Then

89
Chate Coaching Classes [Borivali Branch]

cboFdSub2 = lstFacultydetails.SelectedItem.SubItems(4)
End If
txtFmobno = lstFacultydetails.SelectedItem.SubItems(5)
txtFResNo = lstFacultydetails.SelectedItem.SubItems(6)

txtFaddress1 = lstFacultydetails.SelectedItem.SubItems(7)
DTPickerFD = lstFacultydetails.SelectedItem.SubItems(8)

cmdFdAdd.Enabled = False
cmdFdUpdate.Enabled = True
cmdFdDelete.Enabled = True
cmdfSearch.Enabled = False
cmdFdSave.Enabled = False
cmdCancel.Caption = "Cancel"
cmdCancel.Enabled = True
EnabledC
End If
End Sub
Private Sub txtFacid_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub txtFcontno_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtFacid_Validate(Cancel As Boolean)


cmdFdUpdate.Enabled = True
cmdFdDelete.Enabled = True
Dim rsEDIT As ADODB.Recordset
Dim sql As String

sql = "Select * from Faculty where FacultyId=" & Val(txtFacid) & ""

Set rsEDIT = New ADODB.Recordset


rsEDIT.Open sql, Conn, adOpenKeyset, adLockOptimistic
If Not rsEDIT.EOF Then
'txtFacid = rsEDIT.Fields(0)
txtFn = rsEDIT.Fields(1)
' DTPickerFD = rsEDIT.Fields(2)
cboFdCoursename = rsEDIT.Fields(3)
If Not rsEDIT.Fields(4) = "" Then
cboFdSub1 = rsEDIT.Fields(4)
End If
If Not rsEDIT.Fields(5) = "" Then
cboFdSub2 = rsEDIT.Fields(5)

90
Chate Coaching Classes [Borivali Branch]

End If
txtFmobno = rsEDIT.Fields(6)
txtFResNo = rsEDIT.Fields(7)
txtFaddress1 = rsEDIT.Fields(8)

End If
txtFn.Enabled = True
cboFdCoursename.Enabled = True
cboFdSub1.Enabled = True
cboFdSub2.Enabled = True
txtFmobno.Enabled = True
txtFResNo.Enabled = True
txtFaddress1.Enabled = True

cmdCancel.Enabled = True
cmdCancel.Caption = "Cancel"
End Sub

Private Sub txtFmobno_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub txtFn_KeyPress(KeyAscii As Integer)
KeyAscii = CheckName(KeyAscii)
End Sub
Private Sub txtFResNo_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub cboFdSub1_KeyPress(KeyAscii As Integer)
KeyAscii = CheckName(KeyAscii)
End Sub
Private Sub cboFdSub2_KeyPress(KeyAscii As Integer)
KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub fillSubjectcombo()

Set rs = New ADODB.Recordset


rs.Open "Select SubjectName from subjectsMaster", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboFdSub1.AddItem (rs.Fields("SubjectName"))
cboFdSub2.AddItem (rs.Fields("SubjectName"))
rs.MoveNext
Wend
End Sub

91
Chate Coaching Classes [Borivali Branch]

Private Sub Clear()


txtFacid = ""
txtFn = ""
cboFdCoursename.ListIndex = -1
cboFdSub1.ListIndex = -1
cboFdSub2.ListIndex = -1
txtFmobno = ""
txtFResNo = ""
txtFaddress1 = ""
End Sub
Private Sub EnabledC()
txtFacid.Enabled = True
txtFn.Enabled = True
cboFdCoursename.Enabled = True
cboFdSub1.Enabled = True
cboFdSub2.Enabled = True
txtFmobno.Enabled = True
txtFResNo.Enabled = True
txtFaddress1.Enabled = True
End Sub

5.1.9 Search Faculty Details:

Option Explicit
Dim rs As ADODB.Recordset
Dim list As ListItem
Dim UserMode As String
Private Sub fillList()
'Set rs = New ADODB.Recordset
'rs.Open "Select * from Faculty", Conn, adOpenKeyset, adLockOptimistic
lstSFacultydetails.ListItems.Clear
While rs.EOF <> True
Set list = lstSFacultydetails.ListItems.Add(, , Trim(rs("FacultyId") & ""))
list.SubItems(1) = Trim(rs("FacultyName") & "")
list.SubItems(2) = Trim(rs("CourseName") & "")
list.SubItems(3) = Trim(rs("SubjectName1") & "")
list.SubItems(4) = Trim(rs("SubjectName2") & "")
list.SubItems(5) = Trim(rs("DateOfJoining") & "")
rs.MoveNext
Wend
End Sub

Private Sub cmdfSearch_Click()


frmSearchFaculty.SetFocus

92
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub cmdAppl_Click()


frmAppointment.SetFocus
If cboFaScid <> "" Then
frmAppointment.txtAppFaId = lstSFacultydetails.SelectedItem
End If
End Sub

Private Sub cmdOK_Click()


ClearAll
lstSFacultydetails.ListItems.Clear
End Sub

Private Sub Command1_Click()


Dim str2, str
str2 = "where"
If cboFaScid.Text <> "" Then
str2 = str2 & " FacultyId=" & cboFaScid & " and"
End If
If cboSFn <> "" Then
str2 = str2 & " FacultyName='" & cboSFn & "' and"
End If
If cboCName <> "" Then
str2 = str2 & " CourseName='" & cboCName & "' and"
End If
If cboSSub1 <> "" Then
str2 = str2 & " SubjectName1='" & cboSSub1 & "' or SubjectName2='" & cboSSub1
& "' and"
End If

If cboSSub2 <> "" Then


str2 = str2 & " SubjectName1='" & cboSSub2 & "' or SubjectName2='" & cboSSub2
& "' and"
End If

str = "select * from Faculty " & Left(str2, Len(str2) - 4)

Set rs = New ADODB.Recordset


rs.Open str, Conn, adOpenDynamic, adLockOptimistic
fillList
Set rs = Nothing
'MsgBox str
End Sub

Private Sub cmdBack_Click()

93
Chate Coaching Classes [Borivali Branch]

frmFacultydetails.SetFocus
If cboFaScid <> "" Then
frmFacultydetails.txtFacid = lstSFacultydetails.SelectedItem
frmFacultydetails.txtFacid.SetFocus
End If
End Sub

Private Sub DTPickerSFD_Click()


DTPickerSFD.Value = Date
End Sub

Private Sub Form_Load()


DTPickerSFD.Value = Date
Set rs = New ADODB.Recordset
rs.Open "select *from Faculty", Conn, adOpenDynamic, adLockOptimistic
fillSubjectcombo
fillCoursecombo
fillIdcombo
fillNamecombo
Set rs = Nothing

DTPickerSFD.Value = Date

End Sub

Private Sub lstSFacultydetails_Click()


cboCName.ListIndex = -1
cboFaScid.ListIndex = -1
cboSFn.ListIndex = -1
cboSSub1.ListIndex = -1
cboSSub2.ListIndex = -1
If lstSFacultydetails.ListItems.Count = 0 Then
MsgBox "NO Records", vbOKOnly, "Chate Coaching Classes"
Else
cboFaScid = lstSFacultydetails.SelectedItem
cboSFn = lstSFacultydetails.SelectedItem.SubItems(1)
' DTPickerSFD = lstSFacultydetails.SelectedItem.SubItems(2)
cboCName = lstSFacultydetails.SelectedItem.SubItems(2)
If Not lstSFacultydetails.SelectedItem.SubItems(3) = "" Then
cboSSub1 = lstSFacultydetails.SelectedItem.SubItems(3)
End If
If Not lstSFacultydetails.SelectedItem.SubItems(4) = "" Then
cboSSub2 = lstSFacultydetails.SelectedItem.SubItems(4)
End If
End If

94
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub cboFaScid_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub cboSFn_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub cboCName_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub fillSubjectcombo()


Set rs = New ADODB.Recordset
rs.Open "Select SubjectName from subjectsMaster", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboSSub1.AddItem (rs.Fields("SubjectName"))
cboSSub2.AddItem (rs.Fields("SubjectName"))
rs.MoveNext
Wend
End Sub

Private Sub fillIdcombo()

Set rs = New ADODB.Recordset


rs.Open "Select FacultyId from Faculty", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboFaScid.AddItem (rs.Fields("FacultyId"))
rs.MoveNext
Wend
End Sub

Private Sub ClearAll()

cboFaScid.ListIndex = -1
cboSFn.ListIndex = -1
cboCName.ListIndex = -1
cboSSub1.ListIndex = -1
cboSSub2.ListIndex = -1

End Sub
Private Sub fillNamecombo()

95
Chate Coaching Classes [Borivali Branch]

Set rs = New ADODB.Recordset


rs.Open "Select FacultyName from Faculty", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboSFn.AddItem (rs.Fields("FacultyName"))
rs.MoveNext
Wend
End Sub

Private Sub fillCoursecombo()

Set rs = New ADODB.Recordset


rs.Open "Select courseName from courseMaster", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboCName.AddItem (rs.Fields("courseName"))
rs.MoveNext
Wend
End Sub

5.1.10 Appointment Letter Form:


option Explicit

Private Sub cmdFappCancel_Click()


ClearAll
End Sub

Private Sub cmdFappPrint_Click()


frmCallFacultyAppointment.Show
End Sub

Private Sub Form_Load()


DTPickerApp.Value = Date
End Sub

Private Sub txtAppFaId_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtAppFaId_Validate(Cancel As Boolean)


Dim rsEDIT As ADODB.Recordset
Dim sql As String

sql = "Select * from Faculty where FacultyId=" & Val(txtAppFaId) & ""

96
Chate Coaching Classes [Borivali Branch]

Set rsEDIT = New ADODB.Recordset


rsEDIT.Open sql, Conn, adOpenKeyset, adLockOptimistic
If Not rsEDIT.EOF Then
'txtAppFaId = rsEDIT.Fields(0)
txtAppFname = rsEDIT.Fields(1)
' DTPickerApp = rsEDIT.Fields(2)
txtAppCoursename = rsEDIT.Fields(3)
txtAppSub1 = rsEDIT.Fields(4)
txtAppSub2 = rsEDIT.Fields(5)
End If

End Sub

Private Sub txtAppFname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub txtAppOfferedSal_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtAppSub1_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub txtAppSub2_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub
Private Sub ClearAll()

txtAppFaId = ""
txtAppFname = ""
txtAppCoursename = ""
txtAppSub1 = ""
txtAppSub2 = ""

End Sub

5.1.11 Offered Course Form:


Option Explicit
Dim rs As ADODB.Recordset

97
Chate Coaching Classes [Borivali Branch]

Dim list As ListItem


Dim UserMode As String

Private Sub cmdBatch_Click()


frmBatch.SetFocus
End Sub

Private Sub cmdcancel_Click()


If cmdCancel.Caption = "Exit" Then
Unload Me
Exit Sub
End If
cmdCancel.Caption = "Exit"
txtCourseid = ""
txtCoursename = ""
txtCoursefees = ""
cboSub.ListIndex = -1
lstOC.Clear
cmdOcAdd.Enabled = True
cmdOcUpdate.Enabled = False
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdBatch.Enabled = True
cmdSubAdd.Enabled = False
cmdSubdel.Enabled = False
End Sub

Private Sub cmdOcAdd_Click()


UserMode = "ADD"
txtCourseid = Val(getMaxNo("courseMaster", "CourseId")) + 1
fillenable
txtCoursename = ""
txtCoursefees = ""
cmdOcDelete.Enabled = False
cmdOcUpdate.Enabled = False
cmdOcSave.Enabled = True
cmdCancel.Caption = "Cancel"
cmdCancel.Enabled = True
cmdSubAdd.Enabled = True
cmdSubdel.Enabled = True

txtCoursename.SetFocus
End Sub

Private Sub cmdOcDelete_Click()


Dim sql As String

98
Chate Coaching Classes [Borivali Branch]

If vbYes = MsgBox("Are you sure you want to delete this record?", vbYesNo +
vbQuestion, "CHATE COACHING CLASSES") Then

sql = "Select * from courseMaster where courseId=" & Val(txtCourseid)


Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
If rs.EOF And Not rs.BOF Then
MsgBox "No records to delete"
Else
rs.Delete
rs.Close
sql = "Select * from Coursesubject where CourseId=" & Val(txtCourseid)
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
If rs.EOF And Not rs.BOF Then
MsgBox "No records to delete"
Else
rs.Delete
rs.Close
End If
txtCourseid = ""
txtCoursename = ""
txtCoursefees = ""
Exit Sub
End If
End If

cmdCancel.Enabled = False
cmdOcAdd.Enabled = True
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdOcUpdate.Enabled = True
cmdBatch.Enabled = True
End Sub

Private Sub cmdOcSave_Click()

If txtCoursename = "" Then


MsgBox "Please Enter a Course Name.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
Dim rsSave As ADODB.Recordset
Dim sql As String
sql = "Select * from courseMaster where CourseName='" & Trim(txtCoursename) &
"'"
Set rsSave = New ADODB.Recordset

99
Chate Coaching Classes [Borivali Branch]

rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic


If Not rsSave.EOF Then
MsgBox "Entered Course already exits.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
rsSave.Close
If txtCoursefees = "" Then
MsgBox "Please Enter Course Fees", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If

If UserMode = "ADD" Then

sql = "Select * from courseMaster "


Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew
rsSave("CourseId") = txtCourseid
rsSave("CourseName") = txtCoursename
rsSave("CourseFees") = Val(txtCoursefees)
rsSave.Update
rsSave.Close

Dim i, flg As Integer


Dim subid As String
flg = 0
For i = 0 To lstOC.ListCount - 1

sql = "Select * from subjectsMaster where subjectName='" & lstOC.list(i) & "'"
Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
subid = rsSave.Fields(0)
rsSave.Close
Set rsSave = New ADODB.Recordset
sql = "Select * from Coursesubject"
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew
rsSave("CourseId") = txtCourseid
rsSave("SubjectId") = subid
rsSave.Update
rsSave.Close
Next

ElseIf UserMode = "UPDATE" Then


sql = "Select * from courseMaster where CourseId=" & Val(txtCourseid)
Set rsSave = New ADODB.Recordset

100
Chate Coaching Classes [Borivali Branch]

rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic


'rsSave("CourseId") = txtCourseId
rsSave("CourseName") = txtCoursename
rsSave("CourseFees") = Val(txtCoursefees)
rsSave.Update
rsSave.Close

sql = "DELETE * from Coursesubject where CourseId=" & Val(txtCourseid)


Conn.Execute (sql)
flg = 0
For i = 0 To lstOC.ListCount - 1

sql = "Select * from subjectsMaster where subjectName='" & lstOC.list(i) & "'"
Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
subid = rsSave.Fields(0)
rsSave.Close
Set rsSave = New ADODB.Recordset
sql = "Select * from Coursesubject"
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew
rsSave("CourseId") = txtCourseid
rsSave("SubjectId") = subid
rsSave.Update
rsSave.Close
Next

End If

cmdOcAdd.Enabled = True
cmdOcUpdate.Enabled = False
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdCancel.Caption = "Exit"
cmdCancel.Enabled = True
cmdBatch.Enabled = True
lstOC.Clear
txtCoursefees = ""
txtCoursename = ""
cboSub.ListIndex = -1
txtCourseid = ""

UserMode = ""
fillCourselist
End Sub

101
Chate Coaching Classes [Borivali Branch]

Private Sub cmdOcUpdate_Click()


UserMode = "UPDATE"
cmdOcAdd.Enabled = False
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = True
cmdSubAdd.Enabled = True
cmdSubdel.Enabled = True
cmdCancel.Enabled = True
txtCoursename.SetFocus
End Sub

Private Sub cmdSubAdd_Click()


Dim i, flg As Integer
flg = 0
For i = 0 To lstOC.ListCount - 1
If lstOC.list(i) = cboSub.Text Then
flg = 1
End If
Next
If flg = 0 Then
lstOC.AddItem (cboSub.Text)
Else
MsgBox "Item Already Inserted"
End If
End Sub

Private Sub cmdSubdel_Click()


lstOC.RemoveItem (lstOC.ListIndex)
End Sub

Private Sub Form_Load()


Set rs = New ADODB.Recordset
rs.Open "select *from courseMaster", Conn, adOpenDynamic, adLockOptimistic
fillSubjectcombo
fillCourselist
While Not rs.EOF
cboSub.AddItem (rs.Fields(1))
rs.MoveNext
Wend
Set rs = Nothing

cmdOcAdd.Enabled = True
cmdOcUpdate.Enabled = False
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdCancel.Enabled = True

102
Chate Coaching Classes [Borivali Branch]

cmdBatch.Enabled = True
cmdSubAdd.Enabled = False
cmdSubdel.Enabled = False
End Sub

Private Sub txtCoursefees_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtCourseId_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub lstOffSub_Click()


If lstOffSub.ListItems.Count = 0 Then
MsgBox "No Records"
Else
txtCourseid = lstOffSub.SelectedItem
txtCoursename = lstOffSub.SelectedItem.SubItems(1)
txtCoursefees = lstOffSub.SelectedItem.SubItems(2)
lstOC.Clear
fillSelectedSubject (lstOffSub.SelectedItem)
fillenable
cmdOcAdd.Enabled = False
cmdOcUpdate.Enabled = True
cmdOcDelete.Enabled = True
cmdOcSave.Enabled = False
cmdCancel.Caption = "Cancel"
cmdCancel.Enabled = True
cmdBatch.Enabled = False
End If
End Sub

Private Sub txtCoursename_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub ControlsEnabled()


cmdOcAdd.Enabled = True
cmdOcUpdate.Enabled = True
cmdOcDelete.Enabled = True
End Sub
Private Sub fillSubjectcombo()

Set rs = New ADODB.Recordset

103
Chate Coaching Classes [Borivali Branch]

rs.Open "Select SubjectName from subjectsMaster", Conn, adOpenKeyset,


adLockBatchOptimistic
While rs.EOF <> True
cboSub.AddItem (rs.Fields("SubjectName"))
rs.MoveNext
Wend
End Sub
Private Sub fillSelectedSubject(str)
Dim StrSQl As String
Set rs = New ADODB.Recordset
StrSQl = "Select SubjectName from Coursesubject,subjectsMaster where
Coursesubject.SubjectId=subjectsMaster.SubjectId and Coursesubject.CourseId=" & str
'rs.Open "Select SubjectName from Coursesubject", Conn, adOpenKeyset,
adLockBatchOptimistic
rs.Open StrSQl, Conn, adOpenKeyset, adLockOptimistic
While rs.EOF <> True
lstOC.AddItem (rs.Fields("SubjectName"))
rs.MoveNext
Wend
End Sub
Private Sub fillCourselist()

Set rs = New ADODB.Recordset


rs.Open "Select * from courseMaster", Conn, adOpenKeyset, adLockOptimistic
lstOffSub.ListItems.Clear
While rs.EOF <> True
Set list = lstOffSub.ListItems.Add(, , Trim(rs("courseId") & ""))
list.SubItems(1) = Trim(rs("courseName") & "")
list.SubItems(2) = Trim(rs("courseFees") & "")
rs.MoveNext
Wend
End Sub
Private Sub fillenable()
txtCoursename.Enabled = True
txtCoursefees.Enabled = True
cboSub.Enabled = True
lstOC.Enabled = True
End Sub

5.1.12 Batch Form:

104
Chate Coaching Classes [Borivali Branch]

Option Explicit
Dim rs As ADODB.Recordset
Dim list As ListItem
Dim UserMode As String
Private Sub fillList()

Set rs = New ADODB.Recordset


rs.Open "Select * from BatchMaster,courseMaster where
batchMaster.courseId=courseMaster.courseId", Conn, adOpenKeyset, adLockOptimistic
lstOffcourse.ListItems.Clear
While rs.EOF <> True
Set list = lstOffcourse.ListItems.Add(, , Trim(rs("batchId") & ""))
list.SubItems(1) = Trim(rs("BatchName") & "")
list.SubItems(2) = Trim(rs("BatchTimings") & "")
list.SubItems(3) = Trim(rs("CourseName") & "")
rs.MoveNext
Wend
End Sub

Private Sub cmdcancel_Click()

If cmdCancel.Caption = "Exit" Then


Unload Me
Exit Sub
End If
cmdCancel.Caption = "Exit"
cmdCancel.Enabled = True
Clear
lstOffcourse.Enabled = True
DisabledC
cmdOcAdd.Enabled = True
cmdOcBack.Enabled = True
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdOcUpdate.Enabled = False
End Sub

Private Sub cmdOcBack_Click()


frmOfferedc.SetFocus
End Sub

Private Sub cmdOcAdd_Click()


cmdOcAdd.Enabled = False
UserMode = "ADD"
txtBatchid = Val(getMaxNo("BatchMaster", "BatchId")) + 1
cboCourse.ListIndex = -1

105
Chate Coaching Classes [Borivali Branch]

txtBatchName = ""
txtTimings = ""
cmdOcDelete.Enabled = False
cmdOcUpdate.Enabled = False
cmdOcSave.Enabled = True
cmdCancel.Caption = "Cancel"
cmdCancel.Enabled = True
lstOffcourse.Enabled = False
EnabledC
End Sub

Private Sub cmdOcDelete_Click()


Dim sql As String
If vbYes = MsgBox("Are you sure you want to delete this record?", vbYesNo +
vbQuestion, "CHATE COACHING CLASSES") Then
sql = "Select * from BatchMaster where BatchId=" & Val(txtBatchid)
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenKeyset, adLockOptimistic
If rs.EOF And Not rs.BOF Then
MsgBox "No records to delete"
' Else
' rs.Delete
' rs.Close
End If
rs.Delete
rs.MoveNext
rs.Close
fillList
Clear
Exit Sub
End If
cmdCancel.Enabled = False
cmdOcAdd.Enabled = True
cmdOcBack.Enabled = True
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdOcUpdate.Enabled = True
End Sub
Private Sub cmdOcUpdate_Click()
UserMode = "UPDATE"
cmdOcAdd.Enabled = False
cmdOcDelete.Enabled = False
cmdOcBack.Enabled = False
cmdOcSave.Enabled = True
End Sub

106
Chate Coaching Classes [Borivali Branch]

Private Sub Form_Load()


Set rs = New ADODB.Recordset
rs.Open "select * from BatchMaster", Conn, adOpenDynamic, adLockOptimistic
fillCoursecombo
fillList
Set rs = Nothing
cmdCancel.Enabled = True
cmdOcAdd.Enabled = True
cmdOcBack.Enabled = True
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdOcUpdate.Enabled = False

End Sub

Private Sub fillCoursecombo()

Set rs = New ADODB.Recordset


rs.Open "Select CourseName from courseMaster", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboCourse.AddItem (rs.Fields("CourseName"))
rs.MoveNext
Wend
End Sub
Private Sub ControlsEnabled()
cmdCancel.Enabled = False
cmdOcAdd.Enabled = True
cmdOcBack.Enabled = True
cmdOcDelete.Enabled = False
cmdOcSave.Enabled = False
cmdOcUpdate.Enabled = False
End Sub
Private Sub Clear()
cboCourse.ListIndex = -1
txtBatchid = ""
txtBatchName = ""
txtTimings = ""
End Sub
Private Sub cmdOcSave_Click()
If cboCourse = "" Then
MsgBox "Please Select a Course.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
If txtBatchName = "" Then
MsgBox "Please Enter The Batch Name.", vbOKOnly, "Chate Coaching Classes "

107
Chate Coaching Classes [Borivali Branch]

Exit Sub
End If
If txtTimings = "" Then
MsgBox "Please Enter The Batch Timings.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If

Dim rsSave As ADODB.Recordset


Dim rs1 As ADODB.Recordset
Dim sql As String
If UserMode = "ADD" Then

sql = "Select * from BatchMaster "


Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
Set rs1 = New ADODB.Recordset
sql = "Select * from courseMaster where courseName='" & cboCourse & "'"
rs1.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew

' rsSave("CourseName") = rs1.Fields(0)


rsSave("CourseId") = cboCourse
rsSave("BatchId") = txtBatchid
rsSave("BatchName") = txtBatchName
rsSave("BatchTimings") = txtTimings
rsSave.Update
rsSave.Close

ElseIf UserMode = "UPDATE" Then


sql = "Select * from BatchMaster where BatchId=" & Val(txtBatchid)
Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
'rsSave("CourseName") = cboCourse
rsSave("BatchName") = txtBatchName
rsSave("BatchTimings") = txtTimings
rsSave.Update
rsSave.Close
End If
lstOffcourse.Enabled = True
Clear
Call Form_Load
cboCourse.Enabled = False
txtBatchName.Enabled = False
txtTimings.Enabled = False
UserMode = ""
End Sub

108
Chate Coaching Classes [Borivali Branch]

Private Sub lstOffcourse_Click()


If lstOffcourse.ListItems.Count = 0 Then
MsgBox "NO Records", vbOKOnly, "Chate Coaching Classes"
Else
txtBatchid = lstOffcourse.SelectedItem
cboCourse = lstOffcourse.SelectedItem.SubItems(3)
txtBatchName = lstOffcourse.SelectedItem.SubItems(1)
txtTimings = lstOffcourse.SelectedItem.SubItems(2)
cmdOcDelete.Enabled = True
cmdOcUpdate.Enabled = True
cmdOcAdd.Enabled = False
cmdCancel.Caption = "Cancel"
EnabledC
End If
End Sub
Private Sub EnabledC()
txtBatchName.Enabled = True
txtTimings.Enabled = True
cboCourse.Enabled = True
End Sub
Private Sub DisabledC()
txtBatchName.Enabled = False
txtTimings.Enabled = False
cboCourse.Enabled = False
End Sub

Private Sub txtTimings_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNumBatch(KeyAscii)
End Sub

5.1.13 Student Attendance Form:

Option Explicit
Dim rs As ADODB.Recordset
Dim list As ListItem
Dim List1 As ListItem
Dim UserMode, Status, P, A As String
Private Sub fillList()
Set rs = New ADODB.Recordset
rs.Open "Select * from StudentAttendance", Conn, adOpenKeyset, adLockOptimistic
lstStudattDetails.ListItems.Clear
While rs.EOF <> True
Set list = lstStudattDetails.ListItems.Add(, , Trim(rs("RollNo") & ""))
list.SubItems(1) = Trim(rs("BatchId") & "")

109
Chate Coaching Classes [Borivali Branch]

list.SubItems(2) = Trim(rs("Status") & "")


list.SubItems(3) = Trim(rs("Date") & "")
rs.MoveNext
Wend
End Sub

Private Sub cboBatchid_Click()


If cboBatchid.ListIndex <> -1 Then
fillist
End If
End Sub

Private Sub cboBatchid_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub cboSattRollNo_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub cmdcancel_Click()


cboBatchid = ""
lstStudattDetails.ListItems.Clear
End Sub

Private Sub cmdOK_Click()


cboBatchid.ListIndex = -1
lstStudattDetails.ListItems.Clear
'If lstStudattDetails <> "" Then
'cmdOK.Caption = "OK"
'Else
'cmdOK.Caption = "Exit"
'End If
End Sub

Private Sub cmdSattSave_Click()


Dim rsSave As ADODB.Recordset
Dim sql As String
Dim i As Integer

sql = "Select * from StudentAttendance "


Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenDynamic, adLockOptimistic

For i = 0 To lstStudattDetails.ListItems.Count - 1

110
Chate Coaching Classes [Borivali Branch]

MsgBox lstStudattDetails.ListItems.Item(i + 1).SubItems(1), vbOKOnly


rsSave.AddNew
rsSave("StudentId") = lstStudattDetails.ListItems.Item(i + 1).SubItems(1)
rsSave("BatchId") = cboBatchid.ItemData(cboBatchid.ListIndex)
rsSave("Date") = DTPickerSAT
If lstStudattDetails.ListItems.Item(i + 1).Checked = True Then
rsSave("Status") = "P"
Else
rsSave("Status") = "A"
End If
rsSave.Update
Next
DTPickerSAT.Value = Date
rsSave.Close
MsgBox "Attendance Inserted Successfully! ", vbOKOnly, "Chate Coaching Classes "

UserMode = ""
End Sub

Private Sub cmdSearch_Click()


frmSearchAttendance.SetFocus
End Sub

Private Sub Form_Load()


Set rs = New ADODB.Recordset
rs.Open "select *from StudentAttendance", Conn, adOpenDynamic, adLockOptimistic
' fillList
'fillRollNocombo
fillbatchname
Set rs = Nothing
DTPickerSAT.Value = Date
End Sub
Private Sub txtSattId_KeyPress(KeyAscii As Integer)
KeyAscii = CheckNum(KeyAscii)
End Sub
Private Sub fillbatchname()

Set rs = New ADODB.Recordset


rs.Open "select * from BatchMaster", Conn, adOpenKeyset, adLockBatchOptimistic
Dim i As Integer
While rs.EOF <> True
cboBatchid.AddItem (rs.Fields("BatchName")), i
cboBatchid.ItemData(i) = rs.Fields("BatchId")
i=i+1
rs.MoveNext
Wend

111
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub fillist()


Dim rsattd As New ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "Select * from CourseEnrolled where BatchId=" &
cboBatchid.ItemData(cboBatchid.ListIndex()) & " ", Conn, adOpenDynamic,
adLockBatchOptimistic
While rs.EOF <> True
Set List1 = lstStudattDetails.ListItems.Add(, , Now)
List1.SubItems(1) = Trim(rs("StudentId") & "")
List1.SubItems(2) = Trim(getdesc("Student", "RollNo", "StudentId=" &
rs("StudentId") & ""))
List1.SubItems(3) = Trim(getdesc("Student", "StudentName", "StudentId=" &
rs("StudentId") & ""))
'If Conn.Execute("Select Status From StudentAttendance where date=#" &
DTPickerSAT.Value & "# and studentid=" & rs("StudentId") & "")(0).Value = "P" Then
Set rsattd = New ADODB.Recordset
rsattd.Open "Select Status From StudentAttendance where date=#" &
DTPickerSAT.Value & "# and studentid=" & rs("StudentId") & "", Conn, adOpenKeyset,
adLockBatchOptimistic
If Not rsattd.EOF Then
If rsattd.Fields(0) = "P" Then
'If Conn.Execute("Select Status From StudentAttendance where date=#" &
DTPickerSAT.Value & "# and studentid=" & rs("StudentId")) Then
'(0).Value = "P" Then
List1.Checked = True
End If
End If
rsattd.Close
'list1.SubItems(3) = Trim(rs("RollNo") & "")
' List1.SubItems(4) = Trim(rs("StudentName") & "")

rs.MoveNext
Wend
End Sub

5.1.14 Search Student Attendance Form:

112
Chate Coaching Classes [Borivali Branch]

Private Sub cboBatchid_Click()


'fillList
If cboBatchid.ListIndex <> -1 Then
cboSattSName.Clear
fillstudentname
End If
End Sub

Private Sub cmdOK_Click()


If cmdOk.Caption = "Exit" Then
Unload Me
Exit Sub
End If
cmdOk.Caption = "Exit"
lstStudattDetails.ListItems.Clear
cboBatchid.ListIndex = -1
cbomonth.ListIndex = -1
If cboSattSName <> "" Then
cboSattSName.ListIndex = -1
End If
End Sub

Private Sub cmdview_Click()


cmdOk.Caption = "OK"
'lstStudattDetails.ListItems.Clear
If cboBatchid = "" Or cbomonth = "" Then
MsgBox "Selection Of Batch Name and Month is Compulsory", vbOKOnly +
vbExclamation, "Chate Coaching Classes"
Else
fillist
End If
End Sub

Private Sub Form_Load()


fillbatchname
End Sub
Private Sub fillist()
Dim sql As String
'Dim list1 As ListItem
If cboSattSName.Text <> "" Then
sql = "select * from StudentAttendance where BatchId=" &
cboBatchid.ItemData(cboBatchid.ListIndex) & " and StudentId= " &
cboSattSName.ItemData(cboSattSName.ListIndex) & " " & _
" and format(Date,'MM')=" & cbomonth.ListIndex + 1 & " order by Date "
Else

113
Chate Coaching Classes [Borivali Branch]

'sql = "select * from StudentAttendance where BatchId=" &


cboBatchid.ItemData(cboBatchid.ListIndex) & " and format(Date,'MM')='" &
cbomonth.ListIndex + 1 & "' order by Date"
sql = "select * from StudentAttendance,BatchMaster where
BatchMaster.BatchId=StudentAttendance.BatchId and
Month(StudentAttendance.Date)=" & cbomonth.ListIndex + 1 & " and
StudentAttendance.BatchId=" & cboBatchid.ItemData(cboBatchid.ListIndex) & ""
End If

Dim rsatt As New ADODB.Recordset


rsatt.Open sql, Conn, adOpenDynamic, adLockOptimistic
If rsatt.EOF Then
MsgBox "Record does not Exist!", vbOKOnly + vbExclamation, "Chate
Coaching Classes"
End If

While rsatt.EOF <> True


Set List1 = lstStudattDetails.ListItems.Add(, , rsatt("Date"))
List1.SubItems(1) = Trim(rsatt("StudentId") & "")
List1.SubItems(2) = Trim(getdesc("Student", "RollNo", "StudentId=" &
rsatt("StudentId") & ""))
List1.SubItems(3) = Trim(getdesc("Student", "StudentName", "StudentId=" &
rsatt("StudentId") & ""))
List1.SubItems(4) = rsatt("Status")
' List1.SubItems(3) = Trim(rs("RollNo") & "")
' List1.SubItems(4) = Trim(rs("StudentName") & "")
rsatt.MoveNext
'Set rsatt = Nothing
Wend
End Sub
Private Sub fillbatchname()
Set rs = New ADODB.Recordset
rs.Open "select * from BatchMaster", Conn, adOpenKeyset, adLockBatchOptimistic
Dim i As Integer
While rs.EOF <> True
cboBatchid.AddItem (rs.Fields("BatchName")), i
cboBatchid.ItemData(i) = rs.Fields("BatchId")
i=i+1
rs.MoveNext
Wend
End Sub
Private Sub fillstudentname()
Dim i As Integer
Set rs = New ADODB.Recordset

114
Chate Coaching Classes [Borivali Branch]

rs.Open "Select * from CourseEnrolled where BatchId=" &


cboBatchid.ItemData(cboBatchid.ListIndex()) & " ", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
cboSattSName.AddItem getdesc("Student", "StudentName", " StudentId=" &
rs("StudentId") & "")
cboSattSName.ItemData(i) = rs("StudentId")
i=i+1
rs.MoveNext
Wend
End Sub

Private Sub fillList()


Set rs = New ADODB.Recordset
rs.Open "Select * from CourseEnrolled where BatchId=" &
cboBatchid.ItemData(cboBatchid.ListIndex()) & " ", Conn, adOpenKeyset,
adLockBatchOptimistic
While rs.EOF <> True
Set List1 = lstStudattDetails.ListItems.Add(, , Now)
List1.SubItems(1) = Trim(rs("StudentId") & "")
List1.SubItems(2) = Trim(getdesc("Student", "RollNo", "StudentId=" &
rs("StudentId") & ""))
List1.SubItems(3) = Trim(getdesc("Student", "StudentName", "StudentId=" &
rs("StudentId") & ""))
' List1.SubItems(3) = Trim(rs("RollNo") & "")
' List1.SubItems(4) = Trim(rs("StudentName") & "")

rs.MoveNext
Wend
End Sub

5.1.15 Faculty Attendance Form:

Option Explicit
Dim rs, rsattd As ADODB.Recordset
Dim UserMode, Status, P, A As String
Dim list As ListItem

Private Sub cmdOK_Click()


Unload Me
frmMDIForm1.Show
End Sub

Private Sub cmdSave_Click()

115
Chate Coaching Classes [Borivali Branch]

Dim rsSave As ADODB.Recordset


Dim sql As String
Dim i As Integer

sql = "Select * from FacultyAttendance "


Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic

For i = 0 To lstFacultyAttenddetails.ListItems.Count - 1

MsgBox lstFacultyAttenddetails.ListItems.Item(i + 1).SubItems(1), vbOKOnly


rsSave.AddNew
rsSave("FacultyId") = lstFacultyAttenddetails.ListItems.Item(i + 1).SubItems(1)

' rsSave("FacultyName") = lstFacultyAttenddetails.ListItems.Item(i + 1).SubItems(2)


rsSave("Date") = DTPickerFacatt
If lstFacultyAttenddetails.ListItems.Item(i + 1).Checked = True Then
rsSave("Status") = "P"
Else
rsSave("Status") = "A"
End If
rsSave.Update
Next
DTPickerFacatt.Value = Date
rsSave.Close
MsgBox "Attendence Inserted Successfully! ", vbOKOnly, "Chate Coaching Classes "
End Sub

Private Sub cmdSearch_Click()


frmSearchFacAttendance.SetFocus
End Sub

Private Sub Form_Load()


DTPickerFacatt.Value = Date
Set rs = Nothing
FacAttlist
chkInsert
End Sub

Private Sub FacAttlist()


Set rs = New ADODB.Recordset
rs.Open "Select * from Faculty", Conn, adOpenKeyset, adLockOptimistic
lstFacultyAttenddetails.ListItems.Clear

While rs.EOF <> True


Set list = lstFacultyAttenddetails.ListItems.Add(, , Now)

116
Chate Coaching Classes [Borivali Branch]

list.SubItems(1) = Trim(rs("FacultyId") & "")


list.SubItems(2) = Trim(rs("FacultyName") & "")
Set rsattd = New ADODB.Recordset
rsattd.Open "Select Status From FacultyAttendance where date=#" &
DTPickerFacatt.Value & "# and Facultyid=" & rs("FacultyId") & "", Conn,
adOpenKeyset, adLockBatchOptimistic
If Not rsattd.EOF Then
If rsattd.Fields(0) = "P" Then
'If Conn.Execute("Select Status From StudentAttendance where date=#" &
DTPickerSAT.Value & "# and studentid=" & rs("StudentId")) Then
'(0).Value = "P" Then
list.Checked = True
End If
End If
'If Conn.Execute("Select Status From FacultyAttendance where date=#" &
DTPickerFacatt.Value & "# and FacultyId=" & rs("FacultyId"))(0).Value = "P" Then
'list.Checked = True
rs.MoveNext
Wend
End Sub
Private Sub chkInsert()
Dim i As Integer
i=1
Dim sql As String
sql = "select * from FacultyAttendance where Date=" & Date & ""
Dim rschk As New ADODB.Recordset
'rschk.Open sql, Conn, adOpenDynamic, adLockOptimistic
'MsgBox rschk.RecordCount
'While rschk.EOF <> True

'If rschk("Status") = "P" Then


'lstFacultyAttenddetails.ListItems(i).Checked = True
'
'End If
'If rschk("Status") = "P" Then
'i = i + 1
'End If
'Wend
'MsgBox i
End Sub

Private Sub Resaveatt()


Dim sql As String
sql = "Delete * from FacultyAttendance where Date=" & Val(DTPickerFacatt)
End Sub
5.1.16 Search Faculty Attendance Form:

117
Chate Coaching Classes [Borivali Branch]

Option Explicit
Dim List1 As ListItem
Dim rs As New ADODB.Recordset
Dim rsatt As New ADODB.Recordset

Private Sub cmdOK_Click()

If cmdOK.Caption = "Exit" Then


Unload Me
Exit Sub
End If
cmdOK.Caption = "Exit"
lstFacultyAttenddetails.ListItems.Clear
cboFattSName.ListIndex = -1
cboMonth.ListIndex = -1
End Sub

Private Sub cmdview_Click()


cmdOK.Caption = "OK"
If cboFattSName = "" Or cboMonth = "" Then
MsgBox "Selection Of Faculty Name and Month is Compulsory", vbOKOnly,
"Chate Coaching Classes"
Else
fillist
Dim rsQuery As ADODB.Connection
Dim sqlQuery As String
Dim viewDrop As String
sqlQuery = "create view Query2 as select distinct facultyname, faculty.facultyid
from faculty, facultyattendance where faculty.facultyid = " & 2
viewDrop = "Drop view Query2"
Conn.Execute viewDrop
Conn.Execute sqlQuery
'rptFacAttendance.Show
End If

End Sub

Private Sub Form_Load()


Set rs = New ADODB.Recordset

rs.Open "select * from FacultyAttendance", Conn, adOpenDynamic,


adLockOptimistic
fillFacName
Set rs = Nothing

118
Chate Coaching Classes [Borivali Branch]

'DTPickerSAT.Value = Date

End Sub
Private Sub fillFacName()

Set rs = New ADODB.Recordset


rs.Open "select * from Faculty", Conn, adOpenKeyset, adLockBatchOptimistic
Dim i As Integer
While rs.EOF <> True
cboFattSName.AddItem (rs.Fields("FacultyName")), i
cboFattSName.ItemData(i) = rs.Fields("FacultyId")
i=i+1
rs.MoveNext
Wend
End Sub
Private Sub fillist()
Dim sql As String
sql = "select * from FacultyAttendance where FacultyId=" &
cboFattSName.ItemData(cboFattSName.ListIndex) & " " & _
" and format(Date,'MM')=" & cboMonth.ListIndex + 1 & " "
If rsatt.State = 1 Then rsatt.Close
rsatt.Open sql, Conn, adOpenKeyset, adLockBatchOptimistic
If rsatt.EOF Then
MsgBox "Record does not Exist!", vbOKOnly + vbExclamation, "Chate Coaching
Classes"
End If

While rsatt.EOF <> True


Set List1 = lstFacultyAttenddetails.ListItems.Add(, , rsatt("Date"))
List1.SubItems(1) = Trim(rsatt("FacultyId") & "")
' List1.SubItems(1) = Trim(getdesc("Faculty", "FacultyId", "FacultyId=" &
rsatt("FacultyId") & ""))
List1.SubItems(2) = Trim(getdesc("Faculty", "FacultyName", "FacultyId=" &
rsatt("FacultyId") & ""))
List1.SubItems(3) = rsatt("Status")
rsatt.MoveNext
Wend
End Sub

5.1.17 Inquiry Details Form:

Option Explicit
Dim rs As ADODB.Recordset

119
Chate Coaching Classes [Borivali Branch]

Dim list As ListItem


Dim UserMode As String

Private Sub cmdICancel_Click()


If cmdICancel.Caption = "Exit" Then
Unload Me
Exit Sub
End If
cmdICancel.Caption = "Exit"
txtInqno = ""
txtIname = ""
txtIcontno = ""
txtCourseId = ""
cmdISave.Enabled = False
End Sub

Private Sub cmdIAdd_Click()


UserMode = "ADD"
DTPickerI.Value = Date
txtInqno = Val(getMaxNo("Inquiry", "Inquiryno")) + 1
txtIname = ""
txtIcontno = ""
txtCourseId = ""

txtIname.Enabled = True
txtIcontno.Enabled = True
txtCourseId.Enabled = True

cmdICancel.Enabled = True
cmdICancel.Caption = "Cancel"
cmdISave.Enabled = True

txtIname.SetFocus
End Sub

Private Sub cmdISave_Click()

If txtIname = "" Then


MsgBox "Please Enter Student's Name.", vbOKOnly, "Chate Coaching Classes "
Exit Sub
End If
If txtCourseId = "" Then
MsgBox "Please Enter the Course Name.", vbOKOnly, "Chate Coaching Classes "

120
Chate Coaching Classes [Borivali Branch]

Exit Sub
txtIname.SetFocus
End If
Dim rsSave As ADODB.Recordset
Dim sql As String
If UserMode = "ADD" Then

sql = "Select * from Inquiry "


Set rsSave = New ADODB.Recordset
rsSave.Open sql, Conn, adOpenKeyset, adLockOptimistic
rsSave.AddNew

rsSave("InquiryNo") = txtInqno
rsSave("StudentName") = txtIname
rsSave("StudentContactNo") = Val(txtIcontno)
rsSave("CourseId") = Val(txtCourseId)
rsSave("Date") = DTPickerI
rsSave.Update
' DTPickerI.Value = Date
rsSave.Close

txtInqno = ""
txtIname = ""
txtIcontno = ""
txtCourseId = ""
txtIname.Enabled = False
txtIcontno.Enabled = False
txtCourseId.Enabled = False
cmdICancel.Caption = "Exit"
cmdISave.Enabled = False
End If
UserMode = ""
End Sub

Private Sub Form_Load()


Set rs = New ADODB.Recordset
rs.Open "select *from Inquiry", Conn, adOpenDynamic, adLockOptimistic

Set rs = Nothing

DTPickerI.Value = Date
cmdIAdd.Enabled = True
cmdICancel.Enabled = True
cmdISave.Enabled = False

121
Chate Coaching Classes [Borivali Branch]

End Sub

Private Sub txtIcontno_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

Private Sub txtIname_KeyPress(KeyAscii As Integer)


KeyAscii = CheckName(KeyAscii)
End Sub

Private Sub txtInqno_KeyPress(KeyAscii As Integer)


KeyAscii = CheckNum(KeyAscii)
End Sub

5.1.18 Call Fee-Receipt Form:

Option Explicit

'Private Sub Command1_Click()


'MsgBox Mid(Text2, 3, Len(Text2) - 2)
'deDB.cmdFeereceipt (Val(Mid(Text2, 3, Len(Text2) - 2)))
'DataReport6.Show
'Unload deDB
'End Sub

Private Sub Command1_Click()


MsgBox Mid(cboR, 3, Len(cboR) - 2)
deDB.cmdFeereceipt (Val(Mid(cboR, 3, Len(cboR) - 2)))
DataReport6.Show
Unload deDB
End Sub

Private Sub Form_Load()


fillFacName
End Sub
Private Sub fillFacName()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from Student", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboR.AddItem "S-" & (rs.Fields("StudentId"))
rs.MoveNext
Wend

122
Chate Coaching Classes [Borivali Branch]

End Sub

5.1.19 Call Faculty Appointment Form:

Option Explicit

Private Sub Command1_Click()


deDB.cmdAppointment (cboFid)
DataReport1.Show
Unload deDB

End Sub

Private Sub Form_Load()


fillFacName
End Sub
Private Sub fillFacName()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from Faculty", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboFid.AddItem (rs.Fields("FacultyId"))
rs.MoveNext
Wend
End Sub

5.1.20 Call Student Att Form:

Option Explicit

Private Sub Command2_Click()


deDB.cmdStudentAttendance cboCbn, cboMonth.ListIndex + 1
DataReport3.Show
Unload deDB
End Sub

Private Sub Form_Load()


fillFacName
End Sub
Private Sub fillFacName()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from BatchMaster", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True

123
Chate Coaching Classes [Borivali Branch]

cboCbn.AddItem (rs.Fields("BatchName"))
rs.MoveNext
Wend
End Sub

5.1.21 Call Faculty Att Form:

Option Explicit
Dim rsatt As ADODB.Recordset
Dim rs As ADODB.Recordset

Private Sub Command1_Click()


'fillist
deDB.cmdFacultyAttendance cboFid, cboMonth.ListIndex + 1
DataReport4.Show
Unload deDB
End Sub

Private Sub Form_Load()


fillFacID

End Sub
Private Sub fillFacName()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from Faculty", Conn, adOpenKeyset, adLockBatchOptimistic
While rs.EOF <> True
cboFid.AddItem (rs.Fields("FacultyId"))
rs.MoveNext
Wend
End Sub

Private Sub fillist()


Dim sql As String
sql = "select * from FacultyAttendance where FacultyId=" &
cboFid.ItemData(cboFid.ListIndex) & " " & _
" and format(Date,'MM')=" & cboMonth.ListIndex + 1 & " "
Set rsatt = New ADODB.Recordset
'If rsatt.State = 1 Then rsatt.Close
rsatt.Open sql, Conn, adOpenKeyset, adLockBatchOptimistic
'If rsatt.EOF Then
'MsgBox "Record does not Exist!", vbOKOnly + vbExclamation, "Chate Coaching
Classes"
'End If
End Sub
Private Sub fillFacID()

124
Chate Coaching Classes [Borivali Branch]

Set rs = New ADODB.Recordset


rs.Open "select * from Faculty", Conn, adOpenKeyset, adLockBatchOptimistic
Dim i As Integer
While rs.EOF <> True
cboFid.AddItem (rs.Fields("FacultyId")), i
cboFid.ItemData(i) = rs.Fields("FacultyId")
i=i+1
rs.MoveNext
Wend
End Sub

5.1.22 Call Inquiry Report Form:

Option Explicit
Private Sub Command1_Click()
deDB.conInquiry (cboMonth)
DataReport2.Show
Unload deDB
End Sub

Private Sub Command2_Click()


frmMDIForm1.SetFocus
End Sub

125
Chate Coaching Classes [Borivali Branch]

REFERENCES

• Structured System analysis And Design – J. Satzinger

• Introduction to Database Management System – Korth

• Programming with Visual Basic 6.0 – J. Bradley

126

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