1. ARYABHATTA,AJMER
Hospital Management System Page 1
CONTENTS
1. Introduction
1.1 Purpose
1.2 Scope
1.3 Technologies used
1.4 Overview
2. Overall Description
2.1 Goals of Proposed System
2.2 Background
2.3 Project Requirements
2.4 User Characteristics
2.5 Constraints
3. Conclusion
4. Bibliography
Introduction
2. ARYABHATTA,AJMER
Hospital Management System Page 2
1.1)Purpose
• The Software is for the automation of Hospital Management.
• It maintains two levels of users:-
_ Administrator Level
_ User Level
• The Software includes:-
_ Maintaining Patient details.
_ Providing and maintaining all kinds of tests for a patient.
_ Billing and Report generation.
1.2)Scope
It can be used in any Hospital, Clinic, Dispensary or Pathology labs for maintaining
patient details and their test results.
1.3)Technologiesto be used
This project will be a desktop application to be developed in VB 6.0 having Ms
Access as backend.
• Database Design (Ms Access)
• Form Design (VB 6.0)
• Coding (VB 6.0)
• Testing (VB 6.0)
• Reporting Tool (Data Report)
1.4)Overview
_ Project is related to Hospital Management System.
_ The project maintains two levels of users:-
• Administrator Level-Doctor
• User Level-Data Entry Operator
_ Main facilities available in this project are:-
• Maintaining records of indoor/outdoor patients.
• Maintaining patients diagnosis details, advised tests to be done.
• Providing different test facilities to a doctor for diagnosis of patients.
_ X-Ray
_ Urine Test
_ Stool Test
_ Sonography Test
_ Gastroscopy Test
_ Colonoscopy Test
_ Blood Test
_ Biochemistry Test
• Providing billing details for indoor/outdoor patients.
_ Related test reports, patient details report, prescription and billing reports can
be generated as per user requirements.
_ User or Administrator can search a patient’s record by his/her name or their
registration date.
1. Overall Description
3. ARYABHATTA,AJMER
Hospital Management System Page 3
2.1)Goals of proposedsystem
1. Planned approachtowards working
The working in the organization will be well planned and organized. The data will be
stored properly in data stores, which will help in retrieval of information as well as its
storage.
2. Accuracy
The level of accuracy in the proposed system will be higher. All operation would be
done correctly and it ensures that whatever information is coming from the center is
accurate.
3. Reliability
The reliability of the proposed system will be high due to the above stated reasons. The
reason for the increased reliability of the system is that now there would be proper
storage of information.
4. No Redundancy
In the proposed system utmost care would be that no
information is repeated anywhere, in storage or otherwise. This would assure
economic use of storage space and consistency in the data stored.
5. Immediate retrieval of information
The main objective of proposed system is to provide for a quick and efficient retrieval
of information. Any type of information would be available whenever the user requires.
6. Immediate storage ofinformation
In manual system there are many problems to store the largest amount of information.
7. Easyto Operate
The system should be easy to operate and should be such that it can be developed
within a short period of time and fit in the limited budget of the user.
2.2)Background
A Hospital is a place where Patients come up for general diseases. Hospitals provide
facilities like:-
_ Consultation by Doctors on Diseases.
_ Diagnosis for diseases.
_Providing treatment facility.
_ Facility for admitting Patients (providing beds, nursing, etc.)
Various operational works that are done in a Hospital are:-
_ Recording information about the Patients that come.
_ Generating bills.
_ Recording information related to diagnosis given to Patients.
These are the various jobs that need to be done in a Hospital by the operational staff and
Doctors. All these works are done on papers.
4. ARYABHATTA,AJMER
Hospital Management System Page 4
The work is done as follows:-
_ Information about Patients is done by just writing the Patients name, age and gender.
Whenever the Patient comes up his information is stored freshly.
_ Bills are generated by recording price for each facility provided to Patient on a separate
sheet and at last they all are summed up.
_ Diagnosis information to patients is generally recorded on the document, which contains
Patient information. It is destroyed after some time period to decrease the paper load in the
office.
_ Immunization records of children are maintained in pre-formatted sheets, which are kept
in a file. All this work is done manually by the receptionist and other operational staff and
lot of papers are needed to be handled and taken care of Doctors have to remember various
medicines available for diagnosis and sometimes miss better alternatives as they can’t
remember them at that time.
Project Requirements
Processor RAM Disk Space
Pentium II, Pentium
III,
Pentium IV or higher
64 Mb or Higher 130 Mb
Operating System Database
Win-98, Win-XP, Linux or any
other
higher version
Ms Access
2.4)User Characteristics
Every user should be:
• Comfortable of working with computer.
• He must have knowledge in medical field.
• He must also have basic knowledge of English too.
2.5)Constraints
• GUI is only in English.
• Login and password is used for identification of user and there is no facility for
guest.
Hardware Requirements
Software Requirements
5. ARYABHATTA,AJMER
Hospital Management System Page 5
ARYABHATTA, AJMER
CONTENTS
1. Introduction
1.1 Purpose
1.2 Scope
1.3 Technologies used
1.4 Overview
2. Overall Description
2.1 Goals of Proposed System
2.2 Background
2.3 Project Requirements
2.4 User Characteristics
2.5 Constraints
3. Conclusion
4. Bibliography
6. ARYABHATTA,AJMER
Hospital Management System Page 6
Hospital Management System
SplashScreen:-
General:-
Dim a%
Dim wind$
Dim result As Variant
Text Explicit
Key_Press:-
Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
End Sub
7. ARYABHATTA,AJMER
Hospital Management System Page 7
Form_Load:-
Private Sub Form_Load()
Dim wind$
Dim result As Variant
wind = Space(150)
result = GetComputerName(wind, 150)
Label2.Caption = "This Product Is Regestered To:-" & Trim(wind)
End Sub
Timer_Code:-
Private Sub Timer1_Timer()
a = a + 1
ProgressBar1.Value = a
Splash.MousePointer = 11
lblWarning.Caption = (ProgressBar1.Value / ProgressBar1.Max) * 100 & "%..."
If a = 100 Then
Timer1.Enabled = False
ProgressBar1.Visible = False
Unload Me
MDIForm1.Show
Login.Show
ElseIf a = 7 Then
lbl.Caption = "Peparing User Interface...."
ElseIf a = 10 Then
lbl.Caption = "Peparing User Interface...."
ElseIf a = 15 Then
lbl.Caption = "Loading..."
8. ARYABHATTA,AJMER
Hospital Management System Page 8
ElseIf a = 20 Then
lbl.Caption = "Copying_File..."
ElseIf a = 50 Then
lbl.Caption = "Save_File..!!!"
im1.Picture = LoadPicture("images15.jpg")
lblLicenseTo.ForeColor = vbBlack
lbl.ForeColor = vbBlack
lblWarning.ForeColor = vbBlack
Label1.ForeColor = vbBlack
ElseIf a = 60 Then
lbl.Caption = "Please Wait..."
ElseIf a = 90 Then
lbl.Caption = "Installation Successfull..."
ElseIf a >= 97 Then
lbl.Caption = "Ready to Use..."
End If
End Sub
9. ARYABHATTA,AJMER
Hospital Management System Page 9
Login_Form:-
General:-
Text Explicit
Dim rs As Recordset
Public LoginSucceeded As Boolean
Form_Load:-
Private Sub Form_Load()
Txtuser.BackColor = &H80FFFF
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
To Click On Cancel Button:-
Private Sub cmdCancel_Click()
'set the global var to false
'to denote a failed login
LoginSucceeded = False
Me.Hide
End Sub
10. ARYABHATTA,AJMER
Hospital Management System Page 10
Key_Press On Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
Key_Press On Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
GotFocus On TxtPass:-
Private Sub txtpass_GotFocus()
txtpass.BackColor = &H80FFFF
End Sub
11. ARYABHATTA,AJMER
Hospital Management System Page 11
LostFocus On TxtPass:-
Private Sub txtpass_LostFocus()
txtpass.BackColor = vbWhite
End Sub
GottFocus On Txtuser:-
Private Sub Txtuser_GotFocus()
Txtuser.BackColor = &H80FFFF
End Sub
LostFocus On TxtUser :-
Private Sub Txtuser_LostFocus()
Txtuser.BackColor = vbWhite
End Sub
Modules:-
VariablesDeclare as Generally:-
Public cnn As New Connection.
Public D_id As New Recordset, p As New Recordset, rs As New Recordset, Ref As New
Recordset, p_id As New Recordset, id As New Recordset, Dt As New Recordset, lt As New
Recordset
The API TextViewer(Get_Computer_Name):-
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
12. ARYABHATTA,AJMER
Hospital Management System Page 12
MDIFORM:-
MDIForm_DbiClivk:-
Private Sub MDIForm_DblClick()
Anknowledgement.SHOW
End Sub
MDIForm_Load:-
Private Sub MDIForm_Load()
MDIForm1.Height = Screen.Height
MDIForm1.Width = Screen.Width
If cnn.State = adStateOpen Then
cnn.close
Else
cnn.Open ("provider = microsoft.jet.oledb.4.0;data source=" & App.Path & "HMS.mdb;Jet
OLEDB:Database password=sss")
13. ARYABHATTA,AJMER
Hospital Management System Page 13
End If
End Sub
MDIForm_Unlaod:-
Private Sub MDIForm_Unload(Cancel As Integer)
Dim a%
a = MsgBox("Quit the Project", vbDefaultButton4 + vbYesNoCancel, "HMS_Info...")
If a = vbYes Then
Unload Me
ElseIf a = vbNo Then
Me.Hide
ElseIf a = vbCancel Then
Me.SHOW
End If
End Sub
Click On Lab_Test Menu:-
Private Sub mnlabtest_Click()
Test.SHOW
End Sub
Click On Add_New_Staff Menu:-
Private Sub mnuaddstaff_Click()
ADDStaff.SHOW
End Sub
Click On Acknowledgement Menu:-
Private Sub mnuanknowledgement_Click()
Anknowledgement.SHOW
End Sub
14. ARYABHATTA,AJMER
Hospital Management System Page 14
Click On Discharge_Patient_Ticket Menu:-
Private Sub mnudischargepatientticket_Click()
Dischargeticket.SHOW
End Sub
Click On Doctor_Info Menu:-
Private Sub mnuDoctorinfo_Click()
aboutstaff.SHOW
End Sub
Click On ExitMenu:-
Private Sub mnuexit_Click()
Unload Me
End Sub
Click On add_New_Doctor Menu:-
Private Sub mnunewdoctor_Click()
AddDoctor.SHOW
End Sub
Click On Outer_Patient Menu:-
Private Sub mnuouterpatient_Click()
OuterPatient.SHOW
End Sub
Click On Patient_Details Menu:-
Private Sub mnupatientDetails_Click()
PatientDetails.SHOW
End Sub
15. ARYABHATTA,AJMER
Hospital Management System Page 15
Click On Patient_Discharge_Form Menu:-
Private Sub mnupatientdischargeform_Click()
PatientDetails.SHOW
End Sub
Click On Patient_Registration Menu:-
Private Sub mnupatiententry_Click()
Patient.SHOW
End Sub
Click On Staff_InfoMenu:-
Private Sub mnustaffinfo_Click()
Staffinfo.SHOW
End Sub
Click On Search_Doctor Menu:-
Private Sub mnusearchDoctor_Click()
SearchDoctor.SHOW
End Sub
Click On Search_Staff Menu:-
Private Sub mnuSearchstaff_Click()
aboutstaff.SHOW
End Sub
Click On Standard_ToolBar:-
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If Button.Caption = "Patient_Registration" Then
Patient.SHOW
ElseIf Button.Caption = "Patient_Details" Then
PatientDetails.SHOW
16. ARYABHATTA,AJMER
Hospital Management System Page 16
ElseIf Button.Caption = "Add_Doctor" Then
AddDoctor.SHOW
ElseIf Button.Caption = "Search_Doctor" Then
SearchDoctor.SHOW
ElseIf Button.Caption = "Search_Staff" Then
aboutstaff.SHOW
ElseIf Button.Caption = "New_Staff" Then
ADDStaff.SHOW
ElseIf Button.Caption = "Outer_Patient" Then
OuterPatient.SHOW
ElseIf Button.Caption = "Billing_Voucher" Then
Billings.SHOW
ElseIf Button.Caption = "Lab_Test" Then
Test.SHOW
ElseIf Button.Caption = "Discharge_Patient" Then
PatientDetails.SHOW
End If
End Sub
17. ARYABHATTA,AJMER
Hospital Management System Page 17
Patient_Registration:-
General:-
Dim flag%
To Click On Text:-
Private Sub bloodsugar_Click()
'bloodsugar.Caption = "Blood Sugar"
End Sub
To Click On Text:-
Private Sub bloodtest_Click()
'bloodtest.Caption = "Blood_Test"
End Sub
18. ARYABHATTA,AJMER
Hospital Management System Page 18
To Click On Text:-
Private Sub ctscane_Click()
'ctscane.Caption = "CT_Scane"
End Sub
To Got_Focus On DTPicker:-
Private Sub DTPicker1_GotFocus()
DTPicker1.CalendarBackColor = &H80FFFF
End Sub
To Lost_Focus On Dtpicker1:-
Private Sub DTPicker1_LostFocus()
DTPicker1.CalendarBackColor = vbWhite
End Sub
To Click On Text:-
Private Sub ecg_Click()
ecg.Caption = "ECG"
End Sub
To Click On Button:-
Private Sub exit_Click()
Unload Me
End Sub
20. ARYABHATTA,AJMER
Hospital Management System Page 20
End Sub
To KeyPress On Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
GotFocus On Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
To KeyPress On Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
21. ARYABHATTA,AJMER
Hospital Management System Page 21
End Sub
LostFocus On Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
GotFocus On Text3:-
Private Sub Text3_GotFocus()
Text3.BackColor = &H80FFFF
End Sub
KeyPress On Text3:-
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
LostFocus On Text3:-
Private Sub Text3_LostFocus()
Text3.BackColor = vbWhite
End Sub
22. ARYABHATTA,AJMER
Hospital Management System Page 22
GotFocus On Text4:-
Private Sub Text4_GotFocus()
Text4.BackColor = &H80FFFF
End Sub
KeyPress On Text4:-
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
LostFocus On Text4:-
Private Sub Text4_LostFocus()
Text4.BackColor = vbWhite
End Sub
GotFocus On Text5:-
Private Sub Text5_GotFocus()
Text5.BackColor = &H80FFFF
End Sub
KeyPress On Text5:-
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
23. ARYABHATTA,AJMER
Hospital Management System Page 23
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
LostFocus On Text5:-
Private Sub Text5_LostFocus()
Text5.BackColor = vbWhite
End Sub
GotFocus On Text6:-
Private Sub Text6_GotFocus()
Text6.BackColor = &H80FFFF
End Sub
KeyPress On Text6:-
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
24. ARYABHATTA,AJMER
Hospital Management System Page 24
LostFocus On Text6:-
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
GotFocus On Text7:-
Private Sub Text7_GotFocus()
Text7.BackColor = &H80FFFF
End Sub
KeyPress On Text7:-
Private Sub Text7_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
LostFocus On Text7:-
Private Sub Text7_LostFocus()
Text7.BackColor = vbWhite
End Sub
25. ARYABHATTA,AJMER
Hospital Management System Page 25
Procedure Clear:-
Sub clear()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Doctor.ListIndex = 0
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Rno.ListIndex = 0
Bno.ListIndex = 0
gender.ListIndex = 0
xray.Value = 0
ultrasound.Value = 0
bloodtest.Value = 0
bloodsugar.Value = 0
ecg.Value = 0
ctscane.Value = 0
End Sub
Procedure Unique:-
Sub Unique()
Dim p_id As New Recordset
p_id.Open "select * from Patient_Registration order by Reg_No", cnn, adOpenDynamic,
adLockOptimistic
If p_id.RecordCount = 0 Then
Text1.Text = 0
26. ARYABHATTA,AJMER
Hospital Management System Page 26
Else
p_id.MoveLast
Text1.Text = p_id.Fields("Reg_No").Value + 1
End If
p_id.close
End Sub
GotFocus on Text8:-
Private Sub Text8_GotFocus()
Text8.BackColor = &H80FFFF
End Sub
LostFocus on Text8:-
Private Sub Text8_LostFocus()
Text8.BackColor = vbWhite
End Sub
GotFocus on Text9:-
Private Sub Text9_GotFocus()
Text9.BackColor = &H80FFFF
End Sub
KeyPress on Text9:-
Private Sub Text9_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
27. ARYABHATTA,AJMER
Hospital Management System Page 27
End If
End Sub
LostFocus on Text9:-
Private Sub Text9_LostFocus()
Text9.BackColor = vbWhite
End Sub
To Click on Check_Box:-
Private Sub xray_Click()
xray.Caption = "X-Ray"
End Sub
Procedure Load_Doctor_Name:-
Sub loadDoctorName()
Dim i%, rss As New Recordset
rss.Open "select * from New_Doctor ", cnn, adOpenKeyset, adLockReadOnly
For i = 0 To rss.RecordCount - 1
Doctor.AddItem (rss.Fields("D_Name").Value)
rss.MoveNext
Next
rss.close
End Sub
29. ARYABHATTA,AJMER
Hospital Management System Page 29
To Click on Cammand_Button:-
Private Sub Command1_Click()
Patient_Reports.SHOW
End Sub
To Click on Option_Button:-
Private Sub Date_Click()
Frame2.Visible = True
PatientName.Visible = False
Label1.Visible = False
Label2.Visible = True
DTPicker1.Visible = True
Call loadDTP
End Sub
To Click on Discharge_Button:-
Private Sub discharge_Click()
dischargeform.SHOW
Call catch
End Sub
To Click on Dtpicker:-
Private Sub DTPicker1_Click()
'Call loadDTPData
End Sub
To GotFocus on DTPicker:-
Private Sub DTPicker1_GotFocus()
DTPicker1.CalendarBackColor = &H80FFFF
End Sub
30. ARYABHATTA,AJMER
Hospital Management System Page 30
To LostFocus on DTPicker:-
Private Sub DTPicker1_LostFocus()
DTPicker1.CalendarBackColor = vbWhite
Call loadDTPData
End Sub
Form_Load:-
Private Sub Form_Load()
Call all
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
DTPicker1.Value = Date
End Sub
To Click onGet_Report:-
Private Sub getreport_Click()
If lv.ListItems.Count = 0 Then
Exit Sub
End If
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command3 lv.SelectedItem.Text
Patient_Reports.SHOW
End Sub
31. ARYABHATTA,AJMER
Hospital Management System Page 31
To Click on List_View:-
Private Sub lv_Click()
getreport.Visible = True
discharge.Visible = True
End Sub
To GotFocus on List_View:-
Private Sub lv_GotFocus()
lv.BackColor = &H80FFFF
End Sub
To GotFocus on Text1:-
Private Sub Text1_GotFocus()
Text1.BackColor = &H80FFFF
End Sub
To KeyPress on Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus onText1:-
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite
32. ARYABHATTA,AJMER
Hospital Management System Page 32
End Sub
To GotFocus on Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
To LostFocus on Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
Procedure Of Load_Patient_Data:-
Sub loadPatientdata()
Dim l As ListItem, rss As New Recordset
rss.Open "select * from Patient_Registration where P_Name like '" & PatientName.Text &
"%'", cnn, adOpenKeyset, adLockReadOnly
lv.ListItems.clear
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set l = lv.ListItems.Add(, , rss.Fields("Reg_No").Value)
l.SubItems(1) = rss.Fields("P_Name").Value
l.SubItems(2) = rss.Fields("Age").Value
l.SubItems(3) = rss.Fields("Gender").Value
l.SubItems(4) = rss.Fields("F_Name").Value
l.SubItems(5) = rss.Fields("Dr_Preffered").Value
l.SubItems(6) = rss.Fields("Address").Value
l.SubItems(7) = rss.Fields("Contact_No").Value
l.SubItems(8) = rss.Fields("Body_Sign").Value
33. ARYABHATTA,AJMER
Hospital Management System Page 33
l.SubItems(9) = rss.Fields("Admit_DD").Value
l.SubItems(10) = rss.Fields("R_No").Value
l.SubItems(11) = rss.Fields("B_No").Value
l.SubItems(12) = rss.Fields("X_Ray").Value
l.SubItems(13) = rss.Fields("Ultra_Sound").Value
l.SubItems(14) = rss.Fields("ECG").Value
l.SubItems(15) = rss.Fields("Blood_Test").Value
l.SubItems(16) = rss.Fields("CT_Scane").Value
l.SubItems(17) = rss.Fields("Blood_Sugar").Value
rss.MoveNext
Wend
rss.close
End If
End Sub
Procedure Of Load_Name:-
Sub loadname()
Dim i%, rss As New Recordset
rss.Open "select * from Patient_Registration ", cnn, adOpenKeyset, adLockReadOnly
For i = 0 To rss.RecordCount - 1
PatientName.AddItem (rss.Fields("P_Name").Value)
rss.MoveNext
Next
rss.close
End Sub
34. ARYABHATTA,AJMER
Hospital Management System Page 34
To Click on Option_Button:-
Private Sub optName_Click()
Frame2.Visible = True
PatientName.Visible = True
Label1.Visible = True
Label2.Visible = False
DTPicker1.Visible = False
Call loadname
End Sub
To Click on Option_Button :-
Private Sub PatientName_Click()
Call loadPatientdata
End Sub
To GotFocus on Combo_Box:-
Private Sub PatientName_GotFocus()
PatientName.BackColor = &HC0FFFF
End Sub
To KeyDown on Combo_Box:-
Private Sub PatientName_KeyDown(KeyCode As Integer, Shift As Integer)
Call loadPatientdata
End Sub
To LostFocus on combo_Box:-
Private Sub PatientName_LostFocus()
PatientName.BackColor = vbWhite
End Sub
35. ARYABHATTA,AJMER
Hospital Management System Page 35
Procedure Of LoadDTPData:-
Sub loadDTPData()
Dim l As ListItem, rss As New Recordset
rss.Open "select * from Patient_Registration where Admit_DD like '" & DTPicker1.Value
& "%'", cnn, adOpenKeyset, adLockReadOnly
lv.ListItems.clear
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set l = lv.ListItems.Add(, , rss.Fields("Reg_No").Value)
l.SubItems(1) = rss.Fields("P_Name").Value
l.SubItems(2) = rss.Fields("Age").Value
l.SubItems(3) = rss.Fields("Gender").Value
l.SubItems(4) = rss.Fields("F_Name").Value
l.SubItems(5) = rss.Fields("Dr_Preffered").Value
l.SubItems(6) = rss.Fields("Address").Value
l.SubItems(7) = rss.Fields("Contact_No").Value
l.SubItems(8) = rss.Fields("Body_Sign").Value
l.SubItems(9) = rss.Fields("Admit_DD").Value
l.SubItems(10) = rss.Fields("R_No").Value
l.SubItems(11) = rss.Fields("B_No").Value
l.SubItems(12) = rss.Fields("X_Ray").Value
l.SubItems(13) = rss.Fields("Ultra_Sound").Value
l.SubItems(14) = rss.Fields("ECG").Value
l.SubItems(15) = rss.Fields("Blood_Test").Value
l.SubItems(16) = rss.Fields("CT_Scane").Value
l.SubItems(17) = rss.Fields("Blood_Sugar").Value
36. ARYABHATTA,AJMER
Hospital Management System Page 36
rss.MoveNext
Wend
rss.close
End If
End Sub
Procedure Of Load_DTP:-
Sub loadDTP()
Dim j%, rss As New Recordset
rss.Open "select * from Patient_Registration where Admit_DD =#" & DTPicker1.Value &
"# ", cnn, adOpenKeyset, adLockReadOnly
rss.close
End Sub
Sub all()
PatientName.ListIndex = 0
Frame2.Visible = False
optName.Value = 0
Date.Value = 0
End Sub
Procedure Of Catch:-
Sub catch()
dischargeform.Text1.Text = lv.SelectedItem
dischargeform.txtpn.Text = lv.SelectedItem.SubItems(1)
dischargeform.FatherName.Text = lv.SelectedItem.SubItems(4)
dischargeform.gender.Text = lv.SelectedItem.SubItems(3)
dischargeform.Text2.Text = lv.SelectedItem.SubItems(2)
dischargeform.txtdct.Text = lv.SelectedItem.SubItems(5)
dischargeform.Text5.Text = lv.SelectedItem.SubItems(6)
38. ARYABHATTA,AJMER
Hospital Management System Page 38
To Click On Add_Button:-
Private Sub CmdAdd_Click()
Call Unique
cnn.Execute ("insert into
New_Doctor(D_id,D_Name,Gender,Dept,specialization,Contact_No) values(" &
Text1.Text & ",'" & Text2.Text & "','" & gender.Text & "','" & Text3.Text & "','" &
specialization.Text & "'," & Text6.Text & ")")
Call clear_Doctor
Text2.SetFocus
Call Unique
MsgBox ("Record Successfully Added")
End Sub
To Click on Cancel_Button:-
Private Sub cmdCancel_Click()
Unload Me
End Sub
Form_Load:-
Private Sub Form_Load()
gender.ListIndex = 0
specialization.ListIndex = 0
Call Unique
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
To GotFocus on Combo_Box:-
Private Sub Gender_GotFocus()
gender.BackColor = &H80FFFF
39. ARYABHATTA,AJMER
Hospital Management System Page 39
End Sub
To LostFocus on Combo_Box:-
Private Sub Gender_LostFocus()
gender.BackColor = vbWhite
End Sub
To KeyPress on Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To GotFocus on Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
To KeyPress on Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
40. ARYABHATTA,AJMER
Hospital Management System Page 40
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
To GotFocus on Text3:-
Private Sub Text3_GotFocus()
Text3.BackColor = &H80FFFF
End Sub
To LostFocus on Text3:-
Private Sub Text3_LostFocus()
Text3.BackColor = vbWhite
End Sub
To GotFocus on Text4:-
Private Sub Text4_GotFocus()
Text4.BackColor = &H80FFFF
End Sub
To KeyPress on Text4:-
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
41. ARYABHATTA,AJMER
Hospital Management System Page 41
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text4:-
Private Sub Text4_LostFocus()
Text4.BackColor = vbWhite
End Sub
To GotFocus on Text5:-
Private Sub Text5_GotFocus()
Text5.BackColor = &H80FFFF
End Sub
To KeyPress on Text5:-
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
42. ARYABHATTA,AJMER
Hospital Management System Page 42
Procedure Of Clear_Doctor_Feilds:-
Sub clear_Doctor()
Text2.Text = " "
Text3.Text = " "
Text6.Text = " "
gender.ListIndex = 0
specialization.ListIndex = 0
End Sub
Procedure Of Unique:-
Private Sub Unique()
Dim D_id As New Recordset
D_id.Open "select * from New_Doctor order by D_id", cnn, adOpenDynamic,
adLockOptimistic
If D_id.RecordCount = 0 Then
Text1.Text = 0
Else
D_id.MoveLast
Text1.Text = D_id.Fields("D_id").Value + 1
End If
D_id.close
End Sub
To LostFocus on Text5:-
Private Sub Text5_LostFocus()
09Text5.BackColor = vbWhite
End Sub
43. ARYABHATTA,AJMER
Hospital Management System Page 43
To GotFocus on Text6:-
Private Sub Text6_GotFocus()
Text6.BackColor = &H80FFFF
End Sub
To LostFocus on Text6:-
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
45. ARYABHATTA,AJMER
Hospital Management System Page 45
To Click on Command_Button:-
Private Sub Command1_Click()
DoctorReports.SHOW
End Sub
To Click on Option_Button:-
Private Sub Dept_Click()
Frame2.Visible = True
n.Visible = False
DNAME.Visible = False
DEPT_NAME.Visible = True
d.Visible = True
Call loaddept
End Sub
To Click On Combo_Box:-
Private Sub DEPT_NAME_Click()
Call loadDeptData
End Sub
To GotFocus on Combo_Box:-
Private Sub DEPT_NAME_GotFocus()
DEPT_NAME.BackColor = &H80FFFF
End Sub
To KeyDown on Combo_Box:-
Private Sub DEPT_NAME_KeyDown(KeyCode As Integer, Shift As Integer)
Call loadDeptData
End Sub
46. ARYABHATTA,AJMER
Hospital Management System Page 46
To LostFocus on Combo_Box:-
Private Sub DEPT_NAME_LostFocus()
Call loadDeptData
End Sub
To Click on Combo_Box:-
Private Sub DNAME_Click()
Call loadDoctordata
End Sub
To GotFocus on Combo_Box:-
Private Sub DNAME_GotFocus()
DNAME.BackColor = &H80FFFF
End Sub
To KeyDown on Combo_Box:-
Private Sub DNAME_KeyDown(KeyCode As Integer, Shift As Integer)
Call loadDoctordata
End Sub
To LostFocus on Combo_Box:-
Private Sub DNAME_LostFocus()
Call loadDoctordata
End Sub
Form_Load:-
Private Sub Form_Load()
Call doc
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
47. ARYABHATTA,AJMER
Hospital Management System Page 47
To Click on getreport_Button:-
Private Sub getreport_Click()
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command1 lvd.SelectedItem.Text
DoctorReports.SHOW
End Sub
To Click on List_View :-
Private Sub lvd_Click()
lvd.BackColor = &H80FFFF
getreport.Visible = True
End Sub
To GodFocus on List_View :-
Private Sub lvd_GotFocus()
lvd.BackColor = &H80FFFF
getreport.Visible = True
End Sub
To LostFocus on List_View :-
Private Sub lvd_LostFocus()
lvd.BackColor = vbWhite
End Sub
48. ARYABHATTA,AJMER
Hospital Management System Page 48
Procedure Of Load_Name
Sub loadname()
Dim i%, rss As New Recordset
rss.Open "select * from New_Doctor ", cnn, adOpenKeyset, adLockReadOnly
For i = 0 To rss.RecordCount - 1
DNAME.AddItem (rss.Fields("D_Name").Value)
rss.MoveNext
Next
rss.close
End Sub
Procedure Of Load_Doctor_Data:-
Sub loadDoctordata()
Dim l As ListItem, rss As New Recordset
rss.Open "select * from New_Doctor where D_Name like '" & DNAME.Text & "%'", cnn,
adOpenKeyset, adLockReadOnly
lvd.ListItems.clear
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set l = lvd.ListItems.Add(, , rss.Fields("D_id").Value)
l.SubItems(1) = rss.Fields("D_Name").Value
l.SubItems(2) = rss.Fields("Gender").Value
l.SubItems(3) = rss.Fields("Dept").Value
l.SubItems(4) = rss.Fields("Specialization").Value
l.SubItems(5) = rss.Fields("Contact_No").Value
rss.MoveNext
Wend
49. ARYABHATTA,AJMER
Hospital Management System Page 49
rss.close
End If
End Sub
Procedure Of Load_Dept:-
Sub loaddept()
Dim i%, rss As New Recordset
rss.Open "select * from New_Doctor", cnn, adOpenKeyset, adLockReadOnly
rss.MoveFirst
For i = 0 To rss.RecordCount - 1
DEPT_NAME.AddItem rss.Fields("Dept").Value
rss.MoveNext
Next
rss.close
End Sub
Procedure Of Laod_Dept_Data:-
Sub loadDeptData()
Dim l As ListItem, rss As New Recordset
rss.Open "select * from New_Doctor where Dept like '" & DEPT_NAME.Text & "%'", cnn,
adOpenKeyset, adLockReadOnly
lvd.ListItems.clear
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set l = lvd.ListItems.Add(, , rss.Fields("D_id").Value)
l.SubItems(1) = rss.Fields("D_Name").Value
l.SubItems(2) = rss.Fields("Gender").Value
l.SubItems(3) = rss.Fields("Dept").Value
50. ARYABHATTA,AJMER
Hospital Management System Page 50
l.SubItems(4) = rss.Fields("Specialization").Value
l.SubItems(5) = rss.Fields("Contact_No").Value
rss.MoveNext
Wend
rss.close
End If
End Sub
To Click on Option_Button :-
Private Sub optName_Click()
Frame2.Visible = True
n.Visible = True
DNAME.Visible = True
DEPT_NAME.Visible = False
d.Visible = False
Call loadname
End Sub
Procedure Of Doc:-
Private Sub doc()
Frame2.Visible = False
DNAME.ListIndex = 0
DEPT_NAME.ListIndex = 0
optName.Value = 0
Dept.Value = 0
End Sub
51. ARYABHATTA,AJMER
Hospital Management System Page 51
Add_New_Staff:-
To Click on Close_Button :-
Private Sub close_Click()
Unload Me
End Sub
To GotFocus on Combo_Box :-
Private Sub DD_GotFocus()
DD.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box :-
Private Sub DD_LostFocus()
DD.BackColor = vbWhite
End Sub
52. ARYABHATTA,AJMER
Hospital Management System Page 52
Form_Load:-
Private Sub Form_Load()
Call load
Call Unique
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
To GotFocus on Combo_Box :-
Private Sub Gender_GotFocus()
gender.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box :-
Private Sub Gender_LostFocus()
gender.BackColor = vbWhite
End Sub
To GotFocus on Combo_Box :-
Private Sub Martial_GotFocus()
Martial.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box :-
Private Sub Martial_LostFocus()
Martial.BackColor = vbWhite
End Sub
53. ARYABHATTA,AJMER
Hospital Management System Page 53
To GotFocus on Combo_Box :-
Private Sub MM_GotFocus()
MM.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box :-
Private Sub MM_LostFocus()
MM.BackColor = vbWhite
End Sub
To GotFocus on Combo_Box :-
Private Sub Shift_GotFocus()
Shift.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box :-
Private Sub Shift_LostFocus()
Shift.BackColor = vbWhite
End Sub
Procedure of Show:-
Private Sub SHOW_Click()
cnn.Execute (" insert into
Add_New_Staff(S_id,S_Cate,S_Name,Sex,S_D,S_O,S_B,S_Contact,S_Address,Status,Shif
t,City,State) values(" & Text1.Text & ",'" & Staff.Text & "','" & Text5.Text & "','" &
gender.Text & "'," & DD.Text & ",'" & MM.Text & "'," & YYYY.Text & "," & Text2.Text
& ",'" & Text3.Text & "','" & Martial.Text & "','" & Shift.Text & "','" & Text4.Text & "','"
& Text6.Text & "')")
Call clear_Staff
Call Unique
MsgBox "Record Successfully Added", vbDefaultButton3, "Add New Staff Member"
End Sub
54. ARYABHATTA,AJMER
Hospital Management System Page 54
To GotFocus on Combo_Box :-
Private Sub Staff_GotFocus()
Staff.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box :-
Private Sub Staff_LostFocus()
Staff.BackColor = vbWhite
End Sub
To KeyPress on Text1 :-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To GotFocus onText2 :-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
55. ARYABHATTA,AJMER
Hospital Management System Page 55
To KeyPress on Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus onText2 :-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
To GotFocus on Text3 :-
Private Sub Text3_GotFocus()
Text3.BackColor = &H80FFFF
End Sub
To KeyPress on Text3 :-
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
56. ARYABHATTA,AJMER
Hospital Management System Page 56
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text3 :-
Private Sub Text3_LostFocus()
Text3.BackColor = vbWhite
End Sub
To GotFocus on Text4 :-
Private Sub Text4_GotFocus()
Text4.BackColor = &H80FFFF
End Sub
To KeyPress on Text4 :-
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text4 :-
Private Sub Text4_LostFocus()
Text4.BackColor = vbWhite
End Sub
57. ARYABHATTA,AJMER
Hospital Management System Page 57
To GotFocus on Text5 :-
Private Sub Text5_GotFocus()
Text5.BackColor = &H80FFFF
End Sub
To KeyPress on Text5 :-
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text5:-
Private Sub Text5_LostFocus()
Text5.BackColor = vbWhite
End Sub
To GotFocus on Text6:-
Private Sub Text6_GotFocus()
Text6.BackColor = &H80FFFF
End Sub
58. ARYABHATTA,AJMER
Hospital Management System Page 58
To KeyPress on Text6:-
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
Procedure Of Clear_Staff_Feilds:-
Sub clear_Staff()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Shift.ListIndex = 0
Martial.ListIndex = 0
DD.ListIndex = 0
MM.ListIndex = 0
YYYY.ListIndex = 0
Staff.ListIndex = 0
gender.ListIndex = 0
End Sub
59. ARYABHATTA,AJMER
Hospital Management System Page 59
Procedure Of Unique:-
Private Sub Unique()
Dim id As New Recordset
id.Open "select * from Add_New_Staff order by S_id", cnn, adOpenDynamic,
adLockOptimistic
If id.RecordCount = 0 Then
Text1.Text = 0
Else
id.MoveLast
Text1.Text = id.Fields("S_id").Value + 1
End If
id.close
End Sub
To LostFocus on Text6:-
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
To GotFocus on Combo_Box:-
Private Sub YYYY_GotFocus()
YYYY.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box:-
Private Sub YYYY_LostFocus()
YYYY.BackColor = vbWhite
End Sub
60. ARYABHATTA,AJMER
Hospital Management System Page 60
Procedure Of Load:-
Sub load()
DD.ListIndex = 0
MM.ListIndex = 0
YYYY.ListIndex = 0
gender.ListIndex = 0
Shift.ListIndex = 0
Martial.ListIndex = 0
Staff.ListIndex = 0
End Sub
62. ARYABHATTA,AJMER
Hospital Management System Page 62
Form_Load:-
Private Sub Form_Load()
Call clear
Call all
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
To Click on getreport_Button:-
Private Sub getreport_Click()
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command4 lvs.SelectedItem.Text
StaffReport.SHOW
End Sub
To GotFocus on List_View:-
Private Sub lvs_GotFocus()
lvs.BackColor = &H80FFFF
getreport.Enabled = True
End Sub
To LostFocus on List_View:-
Private Sub lvs_LostFocus()
lvs.BackColor = vbWhite
End Sub
63. ARYABHATTA,AJMER
Hospital Management System Page 63
To Click on Option_Button:-
Private Sub Category_Click()
Frame2.Visible = True
Call loadcate
Label9.Visible = True
Staff.Visible = True
Label5.Visible = False
Staff_Name.Visible = False
End Sub
To Click on Option_Button:-
Private Sub sname_Click()
Label9.Visible = False
Staff.Visible = False
Label5.Visible = True
Staff_Name.Visible = True
Call loadstaffname
Frame2.Visible = True
Label5.Visible = True
Staff_Name.Visible = True
Label9.Visible = False
Staff.Visible = False
End Sub
To Click on combo_Box:-
Private Sub Staff_Click()
Call loadStaffCate
End Sub
64. ARYABHATTA,AJMER
Hospital Management System Page 64
To GotFocus on Combo_Box:-
Private Sub Staff_GotFocus()
Staff.BackColor = &H80FFFF
End Sub
To KeyPress on Combo_Box:-
Private Sub Staff_KeyDown(KeyCode As Integer, Shift As Integer)
Call loadStaffCate
End Sub
To KeyPress on Combo_Box:-
Private Sub Staff_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Combo_Box:-
Private Sub Staff_LostFocus()
Call loadStaffCate
Staff.BackColor = vbWhite
End Sub
65. ARYABHATTA,AJMER
Hospital Management System Page 65
To GotFocus on Text1:-
Private Sub Text1_GotFocus()
Text1.BackColor = &H80FFFF
End Sub
To KeyPress on Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Text1:-
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite
End Sub
To GotFocus on Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
66. ARYABHATTA,AJMER
Hospital Management System Page 66
To KeyPress on Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
Procedure Of ClearFields:-
Sub clear()
Staff_Name.ListIndex = 0
Staff.ListIndex = 0
End Sub
Procedure Of Staff_Name:-
Private Sub Staff_Name_Click()
Call loadStaffData
End Sub
67. ARYABHATTA,AJMER
Hospital Management System Page 67
To GotFocus on Combo_Box:-
Private Sub Staff_Name_GotFocus()
Staff_Name.BackColor = &H80FFFF
End Sub
To KeyDown on Combo_Box:-
Private Sub Staff_Name_KeyDown(KeyCode As Integer, Shift As Integer)
Call loadStaffData
End Sub
To KeyPress on Combo_Box:-
Private Sub Staff_Name_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Combo_Box:-
Private Sub Staff_Name_LostFocus()
Staff_Name.BackColor = vbWhite
End Sub
68. ARYABHATTA,AJMER
Hospital Management System Page 68
Procedure of Load_Staff_Name:-
Sub loadstaffname()
Dim i%, rss As New Recordset
rss.Open "select * from Add_New_Staff ", cnn, adOpenKeyset, adLockReadOnly
For i = 0 To rss.RecordCount - 1
Staff_Name.AddItem (rss.Fields("S_Name").Value)
rss.MoveNext
Next
rss.close
End Sub
Procedure of Load_Staff_Data:-
Sub loadStaffData()
Dim l As ListItem, rss As New Recordset
rss.Open "select * from Add_New_Staff where S_Name like '" & Staff_Name.Text & "%'",
cnn, adOpenKeyset, adLockReadOnly
lvs.ListItems.clear
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set l = lvs.ListItems.Add(, , rss.Fields("S_id").Value)
l.SubItems(1) = rss.Fields("S_Cate").Value
l.SubItems(2) = rss.Fields("S_Name").Value
l.SubItems(3) = rss.Fields("Sex").Value
l.SubItems(4) = rss.Fields("S_D").Value
l.SubItems(5) = rss.Fields("S_O").Value
l.SubItems(6) = rss.Fields("S_B").Value
l.SubItems(7) = rss.Fields("S_Contact").Value
69. ARYABHATTA,AJMER
Hospital Management System Page 69
l.SubItems(8) = rss.Fields("S_Address").Value
l.SubItems(9) = rss.Fields("Status").Value
l.SubItems(10) = rss.Fields("Shift").Value
l.SubItems(11) = rss.Fields("City").Value
l.SubItems(12) = rss.Fields("State").Value
rss.MoveNext
Wend
rss.close
End If
End Sub
Procedurem Of Load_Category:-
Sub loadcate()
Dim i%, rss As New Recordset
rss.Open "select * from Add_New_Staff", cnn, adOpenKeyset, adLockReadOnly
rss.MoveFirst
For i = 0 To rss.RecordCount - 1
Staff.AddItem (rss.Fields("S_Cate").Value)
rss.MoveNext
Next
rss.close
End Sub
Procedure Of Load_Staff_Category:-
Sub loadStaffCate()
Dim ls As ListItem, rss As New Recordset
rss.Open "select * from Add_New_Staff where S_Cate like '" & Staff.Text & "%'", cnn,
adOpenKeyset, adLockReadOnly
lvs.ListItems.clear
70. ARYABHATTA,AJMER
Hospital Management System Page 70
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set ls = lvs.ListItems.Add(, , rss.Fields("S_id").Value)
ls.SubItems(1) = rss.Fields("S_Cate").Value
ls.SubItems(2) = rss.Fields("S_Name").Value
ls.SubItems(3) = rss.Fields("Sex").Value
ls.SubItems(4) = rss.Fields("S_D").Value
ls.SubItems(5) = rss.Fields("S_O").Value
ls.SubItems(6) = rss.Fields("S_B").Value
ls.SubItems(7) = rss.Fields("S_Contact").Value
ls.SubItems(8) = rss.Fields("S_Address").Value
ls.SubItems(9) = rss.Fields("Status").Value
ls.SubItems(8) = rss.Fields("Shift").Value
ls.SubItems(9) = rss.Fields("City").Value
ls.SubItems(8) = rss.Fields("State").Value
rss.MoveNext
Wend
rss.close
End If
End Sub
Procedure Of ClearFields:-
Sub all()
sname.Value = 0
Category.Value = 0
Staff_Name.ListIndex = 0
Staff.ListIndex = 0
71. ARYABHATTA,AJMER
Hospital Management System Page 71
Label5.Visible = False
Label9.Visible = False
Staff_Name.Visible = False
Staff.Visible = False
Frame2.Visible = False
End Sub
72. ARYABHATTA,AJMER
Hospital Management System Page 72
Outer_Patient:-
To Click onCancel_Button:-
Private Sub CANCEL_Click()
Unload Me
End Sub
To GotFocus on Combo_Box:-
Private Sub Doctor_GotFocus()
Doctor.BackColor = &H80FFFF
End Sub
73. ARYABHATTA,AJMER
Hospital Management System Page 73
To LostFocus on Combo_Box:-
Private Sub Doctor_LostFocus()
Doctor.BackColor = vbWhite
End Sub
To GotFocus on Dtpicker:-
Private Sub DTPicker1_GotFocus()
DTPicker1.CalendarBackColor = &H80FFFF
End Sub
To LostFocus on Dtpicker:-
Private Sub DTPicker1_LostFocus()
DTPicker1.CalendarBackColor = vbWhite
End Sub
Private Sub DTPicker2_GotFocus()
DTPicker2.CalendarBackColor = &H80FFFF
End Sub
Private Sub DTPicker2_LostFocus()
DTPicker2.CalendarBackColor = vbWhite
End Sub
Form_Load:-
Private Sub Form_Load()
Call loadDoctorName
Call Outer
Doctor.ListIndex = 0
Text2.BackColor = &H80FFFF
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
74. ARYABHATTA,AJMER
Hospital Management System Page 74
DTPicker1.Value = Date
DTPicker2.Value = Time
End Sub
To Click on Ok_Button:-
Private Sub OK_Click()
cnn.Execute "insert into
Outer_Patient(Ref_No,Op_Name,Dr_Preffered,Contact_No,Address,Ap_Datedd,Ap_Timet
t,Fees)Values(" & Text1.Text & ",'" & Text2.Text & "','" & Doctor.Text & "'," &
Text5.Text & ",'" & Text6.Text & "','" & DTPicker1.Value & "','" & DTPicker2.Value &
"'," & Text4.Text & ")"
Call clear_Outer_Patient
Call Outer
End Sub
To KeyPress on Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
To GotFocus on Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
75. ARYABHATTA,AJMER
Hospital Management System Page 75
End Sub
To KeyPress on Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
To GotFocus on Text3:-
Private Sub Text3_GotFocus()
Text3.BackColor = &H80FFFF
End Sub
To KeyPress on Text3:-
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
76. ARYABHATTA,AJMER
Hospital Management System Page 76
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text3:-
Private Sub Text3_LostFocus()
Text3.BackColor = vbWhite
End Sub
To GotFocus on Text4:-
Private Sub Text4_GotFocus()
Text4.BackColor = &H80FFFF
End Sub
To KeyPress on Text4:-
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
77. ARYABHATTA,AJMER
Hospital Management System Page 77
Procedure Of Clear_Outer_Patient:-
Sub clear_Outer_Patient()
Text1.Text = " "
Text2.Text = " "
Doctor.ListIndex = 0
Text4.Text = " "
Text5.Text = ""
Text6.Text = ""
Doctor.ListIndex = 0
End Sub
Sub Outer()
Dim Ref As New Recordset
Ref.Open "select * from Outer_Patient order by Ref_no", cnn, adOpenDynamic,
adLockOptimistic
If Ref.RecordCount = 0 Then
Text1.Text = 1
Else
Ref.MoveLast
Text1.Text = Ref.Fields("Ref_no").Value + 1
End If
Ref.close
End Sub
To LostFocus on Text4:-
Private Sub Text4_LostFocus()
Text4.BackColor = vbWhite
End Sub
78. ARYABHATTA,AJMER
Hospital Management System Page 78
To GotFocus on Text5:-
Private Sub Text5_GotFocus()
Text5.BackColor = &H80FFFF
End Sub
To KeyPress on Text5:-
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Text5:-
Private Sub Text5_LostFocus()
Text5.BackColor = vbWhite
End Sub
To GotFocus on Text6:-
Private Sub Text6_GotFocus()
Text6.BackColor = &H80FFFF
End Sub
79. ARYABHATTA,AJMER
Hospital Management System Page 79
To LostFocus on Text6:-
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
Procedure Of Load_Doctor_Name:-
Sub loadDoctorName()
Dim i%, rss As New Recordset
rss.Open "select * from New_Doctor ", cnn, adOpenKeyset, adLockReadOnly
For i = 0 To rss.RecordCount - 1
Doctor.AddItem (rss.Fields("D_Name").Value)
rss.MoveNext
Next
rss.close
End Sub
80. ARYABHATTA,AJMER
Hospital Management System Page 80
Lab_test:-
General:-
Dim flag%
To GotFocus on Text_Box:-
Private Sub Age_GotFocus()
Age.BackColor = &H80FFFF
End Sub
To LostFocus on Text_Box:-
Private Sub Age_LostFocus()
Age.BackColor = vbWhite
End Sub
81. ARYABHATTA,AJMER
Hospital Management System Page 81
To Click on Cancel_Button:-
Private Sub CANCEL_Click()
Unload Me
End Sub
To GotFocus on DTPicker:-
Private Sub DTP1_GotFocus()
DTP1.CalendarBackColor = &H80FFFF
End Sub
To LostFocus on DTPicker:-
Private Sub DTP1_LostFocus()
DTP1.CalendarBackColor = vbWhite
End Sub
Form_Load:-
Private Sub Form_Load()
Gender.ListIndex = 0
Test_Name.ListIndex = 0
Call TestName
Call Unique
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
To GotFocus on Combo_Box:-
Private Sub Gender_GotFocus()
Gender.BackColor = &H80FFFF
End Sub
82. ARYABHATTA,AJMER
Hospital Management System Page 82
To LostFocus on Combo_Box:-
Private Sub Gender_LostFocus()
Gender.BackColor = vbWhite
End Sub
To Click on getreport_Button:-
Private Sub getreport_Click()
If lvt.ListItems.Count = 0 Then
Exit Sub
End If
If DataEnvironment2.Connection1.State <> 0 Then
DataEnvironment2.Connection1.close
End If
DataEnvironment2.Connection1.Open
DataEnvironment2.Lab_Test lvt.SelectedItem.Text
Lab_Test.SHOW
End Sub
To Click on OK_Button:-
Private Sub OK_Click()
On Error Resume Next
Call check
If flag = 1 Then
flag = 0
Exit Sub
End If
cnn.Execute ("insert into
Lab_Test(Ref_No,Refer,P_Name,Gender,Age,Address,Lab_Test,Contact_No,DDD)
values(" & Text1.Text & ",'" & Text2.Text & "','" & Text6.Text & "','" & Gender.Text &
83. ARYABHATTA,AJMER
Hospital Management System Page 83
"'," & Text5.Text & ",'" & Text4.Text & "','" & Test_Name.Text & "'," & Text3.Text & ",'"
& DTP1.Value & "')")
MsgBox "Save Recode", vbDefaultButton1, "Lab_Test_Form"
Call clear_Lab_Test
Call Unique
End Sub
To GotFocus on Combo_Box:-
Private Sub Test_Name_GotFocus()
Test_Name.BackColor = &H80FFFF
End Sub
To LostFocus on Combo_Box:-
Private Sub Test_Name_LostFocus()
Test_Name.BackColor = vbWhite
End Sub
To GotFocus on Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
To KeyPress on Text2:-
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
84. ARYABHATTA,AJMER
Hospital Management System Page 84
End If
End Sub
To LostFocus on Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
To GotFocus on Text3:-
Private Sub Text3_GotFocus()
Text3.BackColor = &H80FFFF
End Sub
To KeyPress on Text3:-
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Text3:-
Private Sub Text3_LostFocus()
Text3.BackColor = vbWhite
End Sub
85. ARYABHATTA,AJMER
Hospital Management System Page 85
To GotFocus on Text4:-
Private Sub Text4_GotFocus()
Text4.BackColor = &H80FFFF
End Sub
To KeyPress on Text4:-
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text4:-
Private Sub Text4_LostFocus()
Text4.BackColor = vbWhite
End Sub
To GotFocus on Text5:-
Private Sub Text5_GotFocus()
Text5.BackColor = &H80FFFF
End Sub
To KeyPress on Text5:-
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
86. ARYABHATTA,AJMER
Hospital Management System Page 86
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Text5:-
Private Sub Text5_LostFocus()
Text5.BackColor = vbWhite
End Sub
To GotFocus on Text6:-
Private Sub Text6_GotFocus()
Text6.BackColor = &H80FFFF
End Sub
To KeyPress on Text6:-
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
87. ARYABHATTA,AJMER
Hospital Management System Page 87
To LostFocus on Text6:-
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
Procedure Of Clear_Lab_TestFields:-
Sub clear_Lab_Test()
Text2.Text = " "
Text4.Text = " "
Text6.Text = " "
Text3.Text = " "
Text5.Text = " "
Gender.ListIndex = 0
Test_Name.ListIndex = 0
Text2.SetFocus
End Sub
Proceduren Of Unique:-
Sub Unique()
Dim lt As New Recordset
lt.Open "select * from Lab_Test order by Ref_No", cnn, adOpenDynamic,
adLockOptimistic
If lt.RecordCount = 0 Then
Text1.Text = 1
Else
lt.MoveLast
Text1.Text = lt.Fields("Ref_No").Value + 1
End If
lt.close
88. ARYABHATTA,AJMER
Hospital Management System Page 88
End Sub
Procedure Of Check:-
Sub check()
If Trim(Text2) = "" Then
MsgBox "Lab_Test Health Center Field Can't be Blank", vbOKOnly + vbCritical, "Error
Show"
Text2.SetFocus
flag = 1
Exit Sub
End If
If Trim(Text6) = "" Then
MsgBox "Lab_Test Patient Name Can't be Blank", vbOKOnly + vbCritical, "Error
Show"
Text6.SetFocus
flag = 1
Exit Sub
End If
If Trim(Text5) = "" Then
MsgBox "Lab_Test Age Can't be Blank", vbOKOnly + vbCritical, "Error Show"
Text5.SetFocus
flag = 1
Exit Sub
End If
If Trim(Text4) = "" Then
MsgBox "Lab_Test Address Can't be Blank", vbOKOnly + vbCritical, "Error Show"
Text4.SetFocus
flag = 1
89. ARYABHATTA,AJMER
Hospital Management System Page 89
Exit Sub
End If
If Trim(Text3) = "" Then
MsgBox "Lab_Test Contact_No Can't be Blank", vbOKOnly + vbCritical, "Error Show"
Text3.SetFocus
flag = 1
Exit Sub
End If
End Sub
Procedure Of Test_Name:-
Sub TestName()
Dim l As ListItem, rss As New Recordset
rss.Open "select * from Lab_Test where Ref_No like '" & Text1.Text & "%'", cnn,
adOpenKeyset, adLockReadOnly
lvt.ListItems.clear
If rss.RecordCount > 0 Then
rss.MoveFirst
While rss.EOF = False
Set l = lvt.ListItems.Add(, , rss.Fields("Ref_No").Value)
l.SubItems(1) = rss.Fields("Refer").Value
l.SubItems(2) = rss.Fields("P_Name").Value
l.SubItems(3) = rss.Fields("Gender").Value
l.SubItems(4) = rss.Fields("Age").Value
l.SubItems(5) = rss.Fields("Address").Value
l.SubItems(6) = rss.Fields("Lab_Test").Value
l.SubItems(7) = rss.Fields("Contact_No").Value
l.SubItems(8) = rss.Fields("DDD").Value
91. ARYABHATTA,AJMER
Hospital Management System Page 91
Discharge_form:-
To Click on Dtpicker:-
Private Sub admit_Click()
admit.CalendarBackColor = &H80FFFF
End Sub
To GotFocus on Dtpicker:-
Private Sub admit_GotFocus()
admit.CalendarBackColor = &H80FFFF
End Sub
92. ARYABHATTA,AJMER
Hospital Management System Page 92
To LostFocus on Dtpicker :-
Private Sub admit_LostFocus()
admit.CalendarBackColor = vbWhite
End Sub
To GotFocus on Text_Box:-
Private Sub Bno_GotFocus()
Bno.BackColor = &H80FFFF
End Sub
To LostFocus on Text_Box:-
Private Sub Bno_LostFocus()
Bno.BackColor = vbWhite
End Sub
To Click on Dtpicker:-
Private Sub DOD_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As
Integer, ByVal CallbackField As String, CallbackDate As Date)
DOD.CalendarBackColor = &H80FFFF
End Sub
To Click on Dtpicker:-
Private Sub DOD_Click()
DOD.CalendarBackColor = &H80FFFF
End Sub
To GotFocus on Dtpciker:-
Private Sub DOD_GotFocus()
DOD.CalendarBackColor = &H80FFFF
End Sub
93. ARYABHATTA,AJMER
Hospital Management System Page 93
To LostFocus on Dtpicker:-
Private Sub DOD_LostFocus()
DOD.CalendarBackColor = vbWhite
End Sub
To Click on Exit_Button:-
Private Sub exit_Click()
Unload Me
End Sub
To GotFocus on Text_Box:-
Private Sub FatherName_GotFocus()
FatherName.BackColor = &H80FFFF
End Sub
To LostFocus on Text_Box:-
Private Sub FatherName_LostFocus()
FatherName.BackColor = vbWhite
End Sub
Form_Load:-
Private Sub Form_Load()
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
End Sub
To GotFocus on Combo_Box:-
Private Sub Gender_GotFocus()
gender.BackColor = &H80FFFF
End Sub
94. ARYABHATTA,AJMER
Hospital Management System Page 94
To LostFocus on Combo_Box:-
Private Sub Gender_LostFocus()
gender.BackColor = vbWhite
End Sub
To GotFocus on Text_Box:-
Private Sub Rno_GotFocus()
Rno.BackColor = &H80FFFF
End Sub
To LostFocus on Text_Box:-
Private Sub Rno_LostFocus()
Rno.BackColor = vbWhite
End Sub
To Click on Save_Button:-
Private Sub save_Click()
cnn.Execute ("insert into
Discharge_Form(P_id,P_Name,F_Name,Gender,Age,Dr_Preffered,Address,Contact_No,Bo
dy_Sign,Admit_DD,D_O_D,RNO,BNO,X_Ray,US,ECG,BT,CT,BS,Result,Total_Amount)
values(" & Text1.Text & ",'" & txtpn.Text & "','" & FatherName.Text & "','" & gender.Text
& "'," & Text2.Text & ",'" & txtdct.Text & "','" & Text5.Text & "'," & Text6.Text & ",'" &
Text7.Text & "','" & admit.Value & "','" & DOD.Value & "'," & Rno.Text & "," &
Bno.Text & ",'" & xray.Value & "','" & ultrasound.Value & "','" & ecg.Value & "','" &
bloodtest.Value & "','" & ctscane.Value & "','" & bloodsugar.Value & "','" & Text9.Text &
"'," & Text10.Text & ")")
MsgBox "Record Successsfully Added", vbDefaultButton1, "Discharge Successfully"
Call clear
End Sub
95. ARYABHATTA,AJMER
Hospital Management System Page 95
To GotFocus on Text1:-
Private Sub Text1_GotFocus()
Text1.BackColor = &H80FFFF
End Sub
To KeyPress on Text1:-
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Text1:-
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite
End Sub
To GotFocus on Text10:-
Private Sub Text10_GotFocus()
Text10.BackColor = &H80FFFF
End Sub
96. ARYABHATTA,AJMER
Hospital Management System Page 96
To KeyPress on Text10:-
Private Sub Text10_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To KeyPress on Text3:-
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
97. ARYABHATTA,AJMER
Hospital Management System Page 97
To KeyPress on Text4:-
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
To LostFocus on Text10:-
Private Sub Text10_LostFocus()
Text10.BackColor = vbWhite
End Sub
To GotFocus on Text2:-
Private Sub Text2_GotFocus()
Text2.BackColor = &H80FFFF
End Sub
To LostFocus on Text2:-
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
98. ARYABHATTA,AJMER
Hospital Management System Page 98
To GotFocus on Text5:-
Private Sub Text5_GotFocus()
Text5.BackColor = &H80FFFF
End Sub
To LostFocus on Text5:-
Private Sub Text5_LostFocus()
Text5.BackColor = vbWhite
End Sub
To GotFocus on Text6:-
Private Sub Text6_GotFocus()
Text6.BackColor = &H80FFFF
End Sub
To KeyPress on Text6:-
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or
(KeyAscii = 32) Then
Exit Sub
Else
KeyAscii = 0
End If
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
End Sub
99. ARYABHATTA,AJMER
Hospital Management System Page 99
To LostFocus on Text6:-
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
To GotFocus on Text7:-
Private Sub Text7_GotFocus()
Text7.BackColor = &H80FFFF
End Sub
To KeyPress on Text7:-
Private Sub Text7_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
To LostFocus on Text7:-
Private Sub Text7_LostFocus()
Text7.BackColor = vbWhite
End Sub
To GotFocus on Text9:-
Private Sub Text9_GotFocus()
Text9.BackColor = &H80FFFF
End Sub
100. ARYABHATTA,AJMER
Hospital Management System Page 100
To KeyPress on Text9:-
Private Sub Text9_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Or (KeyAscii = 32) Then
Exit Sub
End If
If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <=
122))) Then
KeyAscii = 0
Exit Sub
End If
End Sub
Procedure Of list:-
Sub list()
admit.Value = Date
txtpn.Text = ""
txtdct.Text = ""
gender.Text = ""
Rno.Text = ""
Bno.Text = ""
End Sub
Procedure Of Load_Patient_Name:-
Sub loadpatientName()
Dim i%, rss As New Recordset
rss.Open "select * from Patient_Registration ", cnn, adOpenKeyset, adLockReadOnly
For i = 0 To rss.RecordCount - 1
PName.AddItem (rss.Fields("P_Name").Value)
rss.MoveNext
101. ARYABHATTA,AJMER
Hospital Management System Page 101
Next
rss.close
End Sub
Procedure Of Unique:-
Private Sub Unique()
Dim p As New Recordset
p.Open "select * from Discharge order by P_id", cnn, adOpenDynamic,
adLockOptimistic
If p.RecordCount = 0 Then
Text1.Text = 0
Else
p.MoveLast
Text1.Text = p.Fields("P_id").Value + 1
End If
p.close
End Sub
Procedure Of ClearFields:-
Sub clear()
Text1.Text = ""
txtpn.Text = ""
txtdct.Text = ""
FatherName.Text = ""
Text2.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
gender.Text = ""
102. ARYABHATTA,AJMER
Hospital Management System Page 102
Rno.Text = ""
Bno.Text = ""
Text9.Text = ""
Text10.Text = ""
xray.Value = 0
ultrasound.Value = 0
ecg.Value = 0
ctscane.Value = 0
bloodtest.Value = 0
bloodsugar.Value = 0
End Sub
To LostFocus on Text9:-
Private Sub Text9_LostFocus()
Text9.BackColor = vbWhite
End Sub
To GotFocus on Txtdct:-
Private Sub txtdct_GotFocus()
txtdct.BackColor = &H80FFFF
End Sub
To LostFocus on Txtdct:-
Private Sub txtdct_LostFocus()
txtdct.BackColor = vbWhite
End Sub
To GotFocus on Txtpn:-
Private Sub txtpn_GotFocus()
txtpn.BackColor = &H80FFFF
104. ARYABHATTA,AJMER
Hospital Management System Page 104
Reports Of HMS
Patient_Reports:-
To Click On GetReport_Button :-
private Sub report_Click()
If lv.ListItems.Count = 0 Then
Exit Sub
End If
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command3 lv.SelectedItem.Text
Patient_Reports.SHOW
End Sub
105. ARYABHATTA,AJMER
Hospital Management System Page 105
Outer_Patient_Reports:-
To Click On GetReport_Button:-
Private Sub report_Click()
If lop.ListItems.Count = 0 Then
Exit Sub
End If
If DataEnvironment2.Connection1.State <> 0 Then
DataEnvironment2.Connection1.close
End If
DataEnvironment2.Connection1.Open
DataEnvironment2.Outer lop.SelectedItem.Text
Outer_Report.SHOW
End Sub
106. ARYABHATTA,AJMER
Hospital Management System Page 106
Doctor_Reports:-
To Click on GetReport_Button:-
Private Sub getreport_Click()
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command1 lvd.SelectedItem.Text
DoctorReports.SHOW
End Sub
Staff_Reports:-
107. ARYABHATTA,AJMER
Hospital Management System Page 107
To Click on GetReport_Button:-
Private Sub getreport_Click()
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command4 lvs.SelectedItem.Text
StaffReport.SHOW
End Sub
Lab_Test_Reports:-
To Click on GetReport_Button:-
Private Sub getreport_Click()
If lvt.ListItems.Count = 0 Then
Exit Sub
End If
If DataEnvironment2.Connection1.State <> 0 Then
DataEnvironment2.Connection1.close
End If
108. ARYABHATTA,AJMER
Hospital Management System Page 108
DataEnvironment2.Connection1.Open
DataEnvironment2.Lab_Test lvt.SelectedItem.Text
Lab_Test.SHOW
End Sub
Dishcarge_Patient_Reports:-
To Click on GetReport_Button:-
Private Sub getreport_Click()
If lvpd.ListItems.Count = 0 Then
Exit Sub
End If
If DataEnvironment1.Connection1.State <> 0 Then
DataEnvironment1.Connection1.close
End If
DataEnvironment1.Connection1.Open
DataEnvironment1.Command6 lvpd.SelectedItem.Text
DischargeReports.SHOW
End Sub
110. ARYABHATTA,AJMER
Hospital Management System Page 110
2. Patient_Registration_Table:-
Field Name Data type Length
Reg_No (Primary Key) Number Long Integer
Patient_Name TTextText 2255 Number
Age Number Long Integer
Gender Text 255
Father_Name Text 255
Dr_Preffered Text 255
Address Text 255
Contact_No Memo 1000
Body_Sign Text 255
Admit_Date Text 255
Room_No Number Long Integer
Bed_No Number Long Integer
X_Ray Text 255
Ultra_Sound Text 255
ECG Text 255
Blood_Test Text 255
CT_Scane Text 255
Blood_Sugar Text 255
111. ARYABHATTA,AJMER
Hospital Management System Page 111
3. Patient Details (Search_Patient) Table:-
Field Name Data type Length
Name Text 255
Admit_Date Text 255
Patient_Name Text 255
Admit_Date Text 255
LV Text 255
4. Doctor Table:-
Field Name Data type Length
Doctor_Id(Primary Key) Number Long Integer
Doctor_Name Text 255
Gender Text 255
Dept_Name Text 255
Specialization Text 255
Contact_No Memo 1000
5. Search Doctor Tables:-
Field Name Data type Length
Name Text Long Integer
Dept_Name Text 255
Doctor_Name Text 255
Dept_Name Text 255
LVD Text 255
112. ARYABHATTA,AJMER
Hospital Management System Page 112
6. Staff Tables:-
Field Name Data type Length
Staff_Id (Primary Key) Number Long Integer
Staff_Category Text 255
Staff_Name Text 255
Sex Text 255
DD Text 255
MM Text 255
YYYY Number Long Integer
Contact_No Memo 1000
Address Text 255
Status Text 255
Work_Time Text 255
City Text 255
State Text 255
113. ARYABHATTA,AJMER
Hospital Management System Page 113
7. Staff Search Tables:-
Field Name Data type Length
Name Text 255
Category Text 255
Staff_Name Text 255
Staff_Category Text 255
LVS Text 255
8. Outer Patient Tables:-
Field Name Data type Length
Ref_No (Primary Key) Number :Long Integer
Patient_Name Text 255
Dr_Preffered Text 255
Room_No Number Long Integer
Contact_No Memo 1000
Address Text 255
App_Date Text 255
App_Time Text 255
Fees Number Long Integer
114. ARYABHATTA,AJMER
Hospital Management System Page 114
9. Laboratory Test Tables:-
Field Name Data type Length
Ref_No(Primary Key) Number Long Integer
Health_Center Text 255
Patient_Name Text 255
Sex Text 255
Age Number Long Integer
Address Text 255
Lab_Test_Name Text 255
Contact_No Memo 1000
Date Text 255
LVT Text 255
115. ARYABHATTA,AJMER
Hospital Management System Page 115
10. DischargePatient Tables:-
Field Name Data type Length
Ref_No Number Long Integer
Patient_Name Text 255
Father_Name Text 255
Gender Text 255
Age Number Long Integer
Dr_Preffered Text 255
Address Text 255
Contact_No Memo 1000
Body_Sign Text 255
Admit_Date Text 255
Discharge_Date Text 255
Room_No Number Long Integer
Bed_No Number Long Inetger
X_Ray Text 255
Ultra_Sound Text 255
ECG Text 255
Blood_Test Text 255
CT_Scane Text 255
Blood_Sugar Text 255
Result Text 255
Total_Amount Number Long Integer
116. ARYABHATTA,AJMER
Hospital Management System Page 116
Data Base In MS Access
Creating a Report using the Access Report Wizard
Microsoft Access provides many built-in wizards which allow one to create database
objects, such as reports, quickly and easily. The following steps demonstrate the process of
creating a very simple report.
1. Choose the Reports Menu: Once a database is opened, the main database menu as
shown below is displayed. Click on the "Reports" selection and a list of the various
reports Microsoft included in the sample database is displayed. Double-click on a few of
these and get a feel for what reports look like and the various types of information that
they contain.
2. Create a new Report: Click on the “New” button and the process of creating a report
scratch will start.
3. Select the Report Wizard: The next screen that appears will require the selection of the
method to be used to create the report. Select the Report Wizard, which will help through
the creation process step-by-step.
4. Choose a Table or query: Choose the source of data for the report. If the information is
to be retrieved from a single table, select it from the drop-down box below. Alternatively,
for more complex reports, the report can be based on the output of a query previously
designed. For example, all of the data we need is contained within the Employees table,
so choose this table and click on OK.
117. ARYABHATTA,AJMER
Hospital Management System Page 117
Data Base Designed In Access
All The Tables Create in Access:-
A. Login.
B. Patient_Registration.
C Outer_Patient.
D Add_New_Doctor.
E. Add_New_Staff.
F. Laboratory Test.
G. Discharge_Patient.
122. ARYABHATTA,AJMER
Hospital Management System Page 122
G.Discharge_Patient:-
To SaveData In Ms_Access:-
cnn.Execute ("insert into
Discharge_Patient(P_id,P_Name,F_Name,Gender,Age,Dr_Preffered,Address,Contact_No,
Body_Sign,Admit_DD,D_O_D,R_No,B_No,XR,US,ECG,BT,CT,BS,Result,Total_Amount
)values(" & Text1.Text & ",'" & txtpn.Text & "','" & FatherName.Text & "','" & txtgen.Text
& "'," & Text2.Text & ",'" & txtdct.Text & "','" & Text5.Text & "'," & Text6.Text & ",'" &
Text7.Text & "','" & admit.Value & "','" & DOD.Value & "'," & Rno.Text & "," &
Bno.Text & ",'" & xray.Value & "','" & ultrasound.Value & "','" & ecg.Value & "','" &
bloodtest.Value & "','" & ctscane.Value & "','" & bloodsugar.Value & "','" & Text9.Text &
"'," & Text10.Text & ")")
To Show SaveMessage:-
MsgBox "Record Successsfully Added first", vbDefaultButton1, "Discharge Successfully"
2.Conclusion
The project Hospital Management System (HMS) is for computerizing the working in a
hospital. The software takes care of all the requirements of an average hospital and is
capable to provide easy and effective storage of information related to patients that come up
to the hospital.
It generates test reports; provide prescription details including various tests. It also provides
billing facility on the basis of patient’s status whether it is an indoor or outdoor patient. The
system also provides the facility of backup as per the requirement.