You are on page 1of 99

P a g e | 1

A PROJECT REPORT

Submitted By
TANUJIT MAITY, BIKRAM DEV ROY, ASIM DAS, SOURAV CHOWDHURY
JYTIRMOY SARKAR & BODHISHATTA ROY CHOWDHURY

in partial fulfillment for the award of the degree
of
DIPLOMA
in
COMPUTER SCIENCE AND TECNOLOGY


Under the guidance of
MR. SYED MASUD SHAHRYAR
HOD, Computer Science & Technology Dept.








DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY
NIBEDITA INSTITUTE OF TECHNOLOGY
NARASINGHPUR, JALANGI
MAY, 2014

P a g e | 2



DECLARATION



We hereby declare that the project entitled HOSPITAL MANAGEMENT SYSTEM submitted
for the Diploma in CST is my original work and the project has not formed the basis for the award of
any degree, associateship, fellowship.


Signature of the Students
Place:
Date:

P a g e | 3



NIBEDITA INSTITUTE OF TECHNOLOGY
NARASIGHAPUR, JALANGI



BONA FIDE CERTIFICATE



This is to certify that this project report , HOSPITAL MANAGEMENT SYSTEM submitted by
TANUJIT MAITY, BIKRAM DEV ROY, ASIM DAS, SOURAV CHOWDHURY JYOTIRMOY
SARKAR & BODHISHATTA ROY CHOWDHURY in partial fulfilment of the requirements for the
award of Diploma in Computer Science and Technology is the bona fide work carried out by them
under my supervision and guidance.

To the best of my knowledge, the matter embodied in the project report has not been submitted to
any other Institute for the award of any Degree or Diploma.




..
SYED MASUD SHAHRYAR
HOD, Computer Science of Technology
Nibedita Institute Of Technology
Narasinghapur, Jalangi



.................................................. ...........................................
RAJENDRA NATH GHOSH PROSENJIT MANDOL
Officer-In-Charge President
Nibedita Institute of Technolgy Nibedita Institute of Technology
Narasighapur, jalangi Narasinghapur, Jalangi

P a g e | 4
ACKNOWLEDGEMENTS


A project is a golden opportunity for learning and self development. We consider
ourselves very lucky and honoured to have so many wonderful people lead me through in
completion of this project.


We are greatly thankful to our beloved sir, Mr Syed Masud Shahryar, HOD of the
department of Computer Science & Technology, NIT for giving us the opportunity to work
under him and lending every support at every stage of this project work. We truly
appreciate and value his esteemed guidance and encouragement from the beginning to the
end of this project. We are indebted to him for having helped us to shape the problem and
providing insights towards the solution. His trust and support inspired us in the most
important moments of making right decisions and we are glad to work with him.


We are very much indebted to the department of Computer Sc. and Technology of Nibedita
Institute of Technology, for giving us a solid foundation in Computer Science.




Signature of the Students ..........

..........

..........

..........

..........

..........






P a g e | 5
TABLES OF CONTENT



















Abstract 2
Problem Description 3
System Specification 4
System Study 5
DFD 9
E-R Diagram 12
Software Description 13
Database Design 28
Sample Coding 32
Output 83
Conclusion 91
Bibliography 93
P a g e | 6

ABSTRACT

Our project Hospital Management system includes registration of patients, storing their
details into the system, and also computerized billing in the pharmacy, and labs. Our software has
the facility to give a unique id for every patient and stores the details of every patient and the staff
automatically. It includes a search facility to know the current status of each room. User can
search availability of a doctor and the details of a patient using the id.
The Hospital Management System can be entered using a username and password.
It is accessible either by an administrator or receptionist. Only they can add data into the database.
The data can be retrieved easily. The interface is very user-friendly. The data are well protected
for personal use and makes the data processing very fast.











P a g e | 7

INTRODUCTION
Hospital Management System is powerful, flexible, and easy to use and is designed and developed
to deliver real conceivable benefits to hospitals.
Hospital Management System is designed for multispeciality hospitals, to cover a wide range of
hospital administration and management processes. It is an integrated end-to-end Hospital
Management System that provides relevant information across the hospital to support effective
decision making for patient care, hospital administration and critical financial accounting, in a
seamless flow.
Hospital Management System is a software product suite designed to improve the quality and
management of hospital management in the areas of clinical process analysis and activity-based
costing. Hospital Management System enables you to develop your organization and improve its
effectiveness and quality of work. Managing the key processes efficiently is critical to the success
of the hospital helps you manage your processes.

PROBLEM INTRODUCTION

Lack of immediate retrievals: -
The information is very difficult to retrieve and to find particular information like- E.g. - To find
out about the patients history, the user has to go through various registers. This results in
inconvenience and wastage of time.
Lack of immediate information storage: -
The information generated by various transactions takes time and efforts to be stored at right
place.
Lack of prompt updating: -
Various changes to information like patient details or immunization details of child are difficult
to make as paper work is involved.
Error prone manual calculation: -
P a g e | 8
Manual calculations are error prone and take a lot of time this may result in incorrect information.
For example calculation of patients bill based on various treatments.
5. Preparation of accurate and prompt reports: -
This becomes a difficult task as information is difficult to collect from various registers.

ESTABLISH THE NEED OF NEW SYSTEM

1. Problem of Reliability: Current system is not reliable. It seems to vary in quality from one
month to the, next. Sometimes it gives good output, but some times the output is worst.
2. Problem of Accuracy: There are too many mistakes in reports.
3. Problem of timeliness: In the current system the reports and output produced is mostly late and
in most of the cases it is useless because it is not on time.
4. Problem of Validity: The output and reports mostly contains misleading information. The
customer's information is sometimes not valid.
5. Problem of Economy: The current system is very costly. We have to spend lots of money to
keep the system up and going, but still not get the desired results.
6. Problem of Capacity: The current system is suffering from problem of capacity also. The staff
for organization is very less and the workload is too much. Few peoples cannot handle all the
work.

PROPOSED SYSTEM

l. Employee Details: The new proposed system stores and maintains all the employees details.
2. Calculations: The new proposed system calculates salary and income tax automatically and
it is very fast and accurate.
3. Registers: There is no need of keeping and maintaining salary and employee register
manually. It remembers each and every record and we can get any report related to employee
and salary at any time.
4. Speed: The new proposed system is very fast with 100% accuracy and saves time.
P a g e | 9
5. Manpower: The new proposed system needs less manpower. Less people can do the large
work.
6. Efficiency: The new proposed systems complete the work of many salesperson in less time.
7. Past details: The new proposed system contains the details of every past doctor and patients
for future assistance.
8. Reduces redundancy: The most important benefit of this system is that it reduces the
redundancy of data within the data.
9. Work load: Reduces the work load of the data store by helping in easy updates of the
products and providing them with the necessary details together with financial transactions
management.
10. Easy statements: Month-end and day-end statement easily taken out without getting
headaches on browsing through the day end statements.

NEED:
The complete set of rules & procedures related to Hospitals day to day activities and generating
report is called HOSPITAL MANAGEMENT SYSTEM. My project gives a brief idea
regarding automated Hospital activities.
The following steps that give the detailed information of the need of proposed system are:
Performance: During past several decades, the hospital management system is supposed to
maintain manual handling of all the hospital daily activities. The manual handling of the record is
time consuming and highly prone to error. To improve the performance of the hospital
management system, the computerized hospital management system is to be undertaken. The
computerized hospital project is fully computerized and user friendly even that any of the
hospitals members can see the patients report and the doctors report.
Efficiency: The basic need of the project is efficiency. The project should be efficient so that
whenever a new patient is admitted, and automatically a bed is assigned and also a doctor is
assigned to the patient according to the patients disease. And if any patient is getting discharged,
the bed assigned to him/her should automatically free in the computer.
Control: The complete control of the project is under the hands of authorized person who has the
password to access this project and illegal access is not supposed to deal with. All the control is
P a g e | 1 0
under the administrator and the other members have the rights to just see the records not to change
any transaction or entry.
Security: Security is the main criteria for the proposed system. Since illegal access may corrupt
the database and it will affect not only the hospital but also it also affects the patients life. So
security has to be given in this project.


SYSTEM SPECIFICATION

1. Hardware Requirements

Processor : Intel core i3 2.4 GHZ or above
Clock speed : 500 MHZ
System bus : 64 bits
RAM : 2GB of RAM
HDD : 40 GB or higher

2. Software Requirements
OS : MS WINDOWS 7
Front End : Visual Basic 6.0
Back End : Microsoft Access 2007




P a g e | 1 1


SYSTEM ANALYSIS

PRINCIPLES OF SYSTEM ANALYSIS:

PRINCIPLES:
Understand the problem before you begin to create the analysis model.
Develop prototypes that enable a user to understand how human machine interaction will
occur.
Record the origin of and the reason for every requirement.
Use multiple views of requirements like building data, function and behavioral models.
Work to eliminate ambiguity
System Analysis is a separation of a substance into parts for study and their implementation and
detailed examination.
Before designing any system it is important that the nature of the business and the way it
currently operates are clearly understood. The detailed examination provides the specific data
required during designing in order to ensure that all the client's requirements are fulfilled. The
investigation or the study conducted during the analysis phase is largely based on the feasibility
study. Rather it would not be wrong to say that the analysis and feasibility phases overlap. High-
level analysis begins during the feasibility study. Though analysis is represented as one phase of
the system development life cycle (SDLC), this is not true. Analysis begins with system
initialization and continues until its maintenance. Even after successful implementation of the
system, analysis may play its role for periodic maintenance and up gradation of t he system. One
of the main causes of project failures is inadequate understanding, and one of the main causes of
inadequate understanding of the requirements is the poor planning of system analysis.

Analysis requires us to recall the objectives of the project and consider following three
questions:
What type of information is required?
P a g e | 1 2
What are the constraints on the investigation?
What are the potential problems that may make the task more difficult?

Keeping the above questions in mind and considering the survey conducted to determine the
need of the system; the total system was designed and can be described as under:
The three major parts of the system are:
Providing Information:

The system is effectively used to provide large variety of information to the interested customer.
The major purpose of the site is to easily provide access to records of various Job seekers &
users of matrimonial such as resume & profile of boys and girls those who want to search a life
partner with quick update to latest modifications in the records. This thing is not at all possible
in printed material, which are updated only once a few weeks. It also gives information about
the general usage of the system for first time visitors. The system itself works as a information
provider for company & life partner seekers.

Preliminary Investigation

System development, a process consisting of two major steps of system analysis and design, start
when management or sometimes system development personnel feel that a new system or an
improvement in the existing system is required. The system development life cycle is classically
thought of as the set of activities that analysts, designers and users carry out to develop and
implement an information system. The system development life cycle consists of the following
activities:
Preliminary investigation
Determination of system requirements
Design of system
Development of software
System testing
Implementation, evaluation, and maintenance
P a g e | 1 3

A request to take assistance from information system can be made for many reasons, but in each
case someone in the organisation initiates the request is made, the first system activity the
preliminary investigation begins. This activity has three parts:

1) Request clarification
2) Feasibility study
3) Request approval

Request clarification: Many requests from employees and users in the organisations are not
clearly defined, Therefore it becomes necessary that project request must be eximined and
clarified properly before considering systems investigation.


FEASIBILITY STUDY:


The feasibility study proposes one or more conceptual solution to the problem set of the project.
In fact, it is an evaluation of whether it is worthwhile to proceed with project or not.
1. Evaluation of feasibility of such solutions. Such evaluation often indicates shortcomings in the
initial goals. This step is repeated as the goals are adjusted and the alternative solutions are
evaluated.
Feasibility analysis usually considers a number of project alternatives, one that is chosen as the
most satisfactory solution. These alternatives also need to be evaluated in a broad way without
committing too many resources. Various steps involved in feasibility analysis are:
2. To propose a set of solution that can realize the project goal. These solutions are usually
descriptions of what the new system should look like.

Four primary areas of interest in feasibility study are:

P a g e | 1 4

1. ECONOMIC FEASIBILITY:
An evaluation of development cost weighed against the ultimate income of benefit derived from
the development system of product. In economic feasibility, cost benefit analysis is done in which
expected cost and benefits are evaluated.
COST AND BENEFIT ANALYSIS:
Developing an IT application is an investment. Since after developing that application it provides
the organization with profits. Profits can be monetary or in the form of an improved working
environment. However, it carries risks, because in some cases an estimate can be wrong. And the
project might not actually turn out to be beneficial.
Cost benefit analysis helps to give management a picture of the cost, benefits and risks. It usually
involves comparing alternate investments.
Cost benefit determines the benefits and savings that are expected from the system and compares
them with the expected costs.
In performing cost and benefit analysis it is important to identify cost and benefits factors. Cost
and benefits can be categorized into the following categories:

1. Development Costs Development costs is the costs that are incurred during the
development of the system. It is one time investment.
2. Operating Costs Operating Costs are the expenses required for the day to day running of
the system. Examples of Operating Costs are Wages, Supplies and Overheads.
3. Hardware/Software Costs It includes the cost of purchasing or leasing of computers and
its peripherals. Software costs involves required S/W costs.
4. Personnel Costs It is the money spent on the people involved in the development of the
system.
5. Facility Costs Expenses that are incurred during the preparation of the physical site where
the system will be operational. These can be wiring, flooring, acoustics, lightning, and air-
conditioning.
6. Supply Costs These are variable costs that are very proportionately with the amount of use
of paper, ribbons, disks, and the like.

P a g e | 1 5

BENEFITS

We can define benefits as Profit or Benefit = Income Costs
Benefits can be accrued by:
Increasing income, or
Decreasing costs, or
Both

2. TECHNICAL FEASIBILITY:
Technical Feasibility includes existing and new H/W and S/W requirements that are required to
operate the project using JSP. The basic S/W requirement is J2EE in which the front end of the
online hospital management project has been done. The basic entry forms are developed in JSP
and the data is stored in the MY SQL.
3. OPERATIONAL FEASIBILITY:
Operational feasibility is mainly concerned with issues like whether the system will be used if it is
developed and implemented. Whether there will be resistance from users that will affect the
possible application benefits? The essential questions that help in testing the technical feasibility
of a system are following:
Does management support the project?
Are the users not happy with current business practices? Will it reduce the time considerably?
If yes, then they will welcome the change and the new system.
Have the users involved in the planning and development of the project? Early involvement
reduced the probability of resistance towards the new system.
Will the proposed system really benefit the organization? Does the overall response increase?
Will accessibility of information be lost? Will the system affect the customers in considerable
way?

LEGAL FEASIBILITY:
P a g e | 1 6
A determination of any infringement, violation, or liability that could result from development of
the system. Legal feasibility tells that the software used in the project should be original
purchased from the legal authorities and they have the license to use it or the software are pirated.
Alternatives:
An evaluation of alternative approaches to the development of system or product.

SYSTEM LIFE CYCLE:

System life cycle is an organizational process of developing and maintaining systems. It helps in
establishing a system project plan, because it gives overall list of processes and sub-processes
required for developing a system.
System development life cycle means combination of various activities. In other words we can say
that various activities put together are referred as system development life cycle. In the System
Analysis and Design terminology, the system development life cycle means software development
life cycle.
Following are the different phases of software development cycle:
System study
Feasibility study
System analysis
System design
Coding
Testing
Implementation
Maintenance



P a g e | 1 7



DATA FLOW DIAGRAMS

DFD for Login Module





DFD for Medical Advice








Data base

Ok
Rejected
User Name
Password
Verifying User
Name and
Password
Administrator
Enter Administrator/User
Login File
User Name
Password

Patient
1. Read the
Data from
patient
2. Search for
disease from
Knowledge
3. Copy
Selected Record
Output Unit
P a g e | 1 8



DFD for patient Appointment









Database

DFD for Patient Search




Database



USER
1. Read
patient
request
2. Search
from Doctor
Data base
3. Give the
Time and
Number

Output UNIT
Patient 1. Read the
Data from
patient
2. Search the
patient in
patient-ID
3. Copy
Selected
Record

Output Unit
P a g e | 1 9



DFD For Bill Payment


DATABASE





















Accountant
1. Read the
Patient
Data &
Treatment
2. Generate
the bill

Print Bill
Output
Device
Patient
P a g e | 2 0




DFD For Online Searching For Patient

Data base






DFD For Searching a Doctors

Data Base





User
Read
Patient
Name
Patient Data
CRT

User
Read the
Data of Doctor &
Specialisation
Doctors
With Specialties
CRT
P a g e | 2 1



















P a g e | 2 2



















P a g e | 2 3




ENTITY RELATIONSHIP DIAGRAM















Works
On
Employee Department
Date-Started
Dept number
Dept Name
Emp- Number
Name
Address
Controls
Administrator
HOD
Doctor
Dr-ID
Name
Address
Works
On
Name
Treat
ed by
Patient
Patient ID
Name
Address
P a g e | 2 4





SOFTWARE DESCRIPTION

MICROSOFT VISUAL BASIC 6.0

Visual Basic 6.0 is Microsofts latest version of the Visual Basic Programming language.
Although writing programs can be a tedious chore at time. Visual Basic reduces the effort
required on your part, and makes programming enjoyable. Visual Basic makes many aspects of
programming as simple as dragging graphics objects on to screen with your mouse.

Visual Basic 6.0 is more than just a programming language; the secret to Visual Basic is in
its name Visual. With to days Windows Operating System, a program must be able to interact
with the screen. Keyboard, mouse and printer graphically.
The environment provided by Visual Basic is suitable for any type of application. Using
this environment, the user can visually design the objects that your application uses. Visual Basic
is not just a languages, its an integrated development environment in which you can develop, run,
test and debug your applications. The impressive array of programming resources provided by
Visual Basic enables to create the objects extemporaneously which can range from pop-up menu
to a message box.
A form is a major part of Visual Basic application, which allows the user to enter the data
as well as view the result. A control is an object that we draw on a form to enable or enhance user
interaction with an application. Hence a Visual Basic application is a combination of object like
forms and controls, procedures that can respond to Events and other general-purpose procedures.
P a g e | 2 5
Starting Visual Basic
To start Visual Basic:
Click on the Start button on the Windows task bar.
Select Programs, then Microsoft Visual Basic # (where # is your version of
Visual Basic).
Click on Visual Basic # (where again # is your version)




At the top of the screen is the Visual Basic Main Window. At the top of the main window is the
Title Bar. The title bar gives us information about what program were using and what Visual
Basic program we are working with. Under the main menu is the Toolbar. Here little buttons
with pictures also allow us to control Visual Basic, much like the main menu. If you put the
mouse cursor over one of these buttons for a second or so, a little tool tip will pop up and tell
you what that particular button does.
Title Bar Main Menu Toolbar
P a g e | 2 6
Parts of a Visual Basic Project
There are three major components in a Visual Basic project: the project itself, the form,
and the controls. Project is the word used to encompass everything in a Visual Basic project.
Other words used to describe a project are application or program. The Form is the window
where you create the interface between the user and the computer. Controls are graphical
features or tools that are placed on forms to allow user interaction (text boxes, labels, scroll bars,
command buttons). Recall the form itself is a control. Controls are also referred to as objects.
Pictorially, a project is:







Project consists of a form containing several controls. In looking around your computers file
directory, you may find some files associated with a Visual Basic project. Two primary files are
used to save a Visual Basic project. The project file will have an extension of vbp (in addition,
there is sometimes a file with a vbw extension). The form file has an extension of frm (in
addition, there is sometimes a form file with an frx extension).
An important concept concerning a Visual Basic project is that of a property. Every
characteristic of a control (including the form itself) is specified by a property. Example
properties include names, captions, sizes, colors, position on the form, and contents.
Visual Basic is an event-driven language. Visual Basic is governed by an event
processor. That means that nothing happens in a Visual Basic project until some event occurs.
Once an event is detected, the project finds a series of instructions related to that event, called an
event procedure. That procedure is executed, and then program control is returned to the event:



Control
Control
Control
Control
Project
Form
P a g e | 2 7



EVENT





Event procedures are where we do the actual computer programming and are saved with
the form in the file with the frm extension. These procedures are where we write BASIC
language statements. You will learn a lot of programming and BASIC language in this course.
The BASIC you will learn is very similar to the original BASIC used by Bill Gates and Paul Allen
when starting Microsoft.

Parts of the Visual Basic Program

Visual Basic is more than just a computer language. It is a project building environment.
Within this one environment, we can begin and build our project, run and test our project,
eliminate errors (if any) in our project, and save our project for future use. With other computer
languages, many times you need a separate text editor to write your program, something called a
compiler to create the program, and then a different area to test your program. Visual Basic
integrates each step of the project building process into one environment. Lets look at the parts
of the Visual Basic environment.

Main Window

Event processor
Event
Procedure
Event
Procedure
Event
Procedure
P a g e | 2 8
Start Visual Basic using the procedure learned in Class 1. Notice that several windows
appear. The Main Window is used to control most aspects of the Visual Basic project building
and running process.

The main window consists of the title bar, menu bar, and toolbar. The title bar indicates the
project name and the current Visual Basic operating mode (design, break, run). The menu bar has
drop-down menus from which you control the operation of the Visual Basic environment.
Form Window
The Form Window is central to developing Visual Basic applications. It is where you
develop your application.



If the form window is not present on the screen:
Properties
Like all controls, the form has many (over 40) properties. Fortunately, we only have to
know about some of them. The properties we will be concerned with are:

Property Description
Name Name used to identify form. Three letter prefix for form names is frm.
P a g e | 2 9
Caption Text that appears in the title bar of form.
Icon Reference to icon that appears in title bar of form.
Left Distance from left side of computer screen to left side of form.
Top Distance from top side of computer screen to top side of form.
Width Width of the form in twips.
Height Height of form in twips.
Back Color Background color of form.
Border Style Form can either be sizable (can resize using the mouse) or fixe size.

Form Events

The form primarily acts as a container for other controls, but it does support events. That
is, it can respond to some user interactions. We will only be concerned with two form events in
this course:

Event Description
Click Event executed when user clicks on the form with the mouse.
Load Event executed when the form first loads into the computers
memory. This is a good place to set initial values for various
properties and other project values.

P a g e | 3 0


Toolbox Window
The Toolbox Window is the selection menu for controls used in your application.
VB6:










If the toolbox window is not present on the screen, click View on the main menu, then Toolbox.
Features of Visual Basic:
1. Good User Interface.
Pointer
Label
Frame
Check Box
Combo Box
Horizontal Scroll Bar
Timer
Directory
Shape
Image
OLE
Picture Box
Text Box
Command Button
Option Button
List Box
Vertical Scroll Bar
Drive
Files
Line
Data Control
P a g e | 3 1
2. OLE Features.
3. Windows API Features.
4. 32 bit Programming Languages.
5. Data Management
6. Online Help
7. Data Access.

Areas of Application
The term "Personal Programming" refers to the idea that, wherever you work, whatever you do,
you can expand your computer's usefulness by writing applications to use in your own job.
Personal Programming is what Visual Basic is all about.
Using Visual Basic's tools, you quickly translate an abstract idea into a program design you can
actually see on the screen. VB encourages you to experiment, revise, correct, and network your
design until the new project meets your requirements. However, most of all, it inspires your
imagination and creativity.
Visual Basic is ideal for developing applications that run in the new Windows 95 operating
system. VB presents a 3-step approach for creating programs:
1. Design the appearance of your application.
2. Assign property settings to the objects of your program.
3. Write the code to direct specific tasks at runtime.
Visual Basic can and is used in a number of different areas, for example:
Education
Research
Medicine
Business
Commerce
Marketing and Sales
Accounting
P a g e | 3 2
Consulting
Law
Science
MICROSOFT ACCESS 2007.

Microsoft Access is the default database of Microsoft Visual Basic. Microsoft Access
2007 provides many new features that make working with data and designing a database even
easier. Microsoft Access Database is a collection of data and objects related to particular topic or
purpose. Microsoft Access Database may contain tables; queries, forms, reports, macros modules
and shortcuts top data access pages.
Microsoft Access is a Relational Database Management System. Using Access we can
organize our data according to subject and can store information about how different subject are
related. In general MS-Access database can have several small tables.
Microsoft Office Access, previously known as Microsoft Access, is a relational database
management system from Microsoft that combines the relational Microsoft Jet Database Engine
with a graphical user interface and software development tools. It is a member of the 2007
Microsoft Office system.
Access can use data stored in Access/Jet, Microsoft SQL Server, Oracle, or any ODBC-compliant
data container (including MySQL and PostgreSQL). Skilled software developers and data
architects use it to develop application software. Relatively unskilled programmers and non-
programmer "power users" can use it to build simple applications. It supports some object-
oriented techniques but falls short of being a fully object-oriented development tool.
Access was also the name of a communications program from Microsoft, meant to compete with
ProComm and other programs. This proved a failure and was dropped. Years later Microsoft
reused the name for its database software.

Access is used by small businesses, within departments of large corporations, and by hobby
programmers to create ad hoc customized desktop systems for handling the creation and
manipulation of data. Access can be used as a database for basic web based applications hosted on
Microsoft's Internet Information Services and utilizing Microsoft Active Server Pages ASP. Most
typical web applications should use tools like ASP/Microsoft SQL Server or the LAMP stack.
P a g e | 3 3
Some professional application developers use Access for rapid application development,
especially for the creation of prototypes and standalone applications that serve as tools for on-the-
road salesmen. Access does not scale well if data access is via a network, so applications that are
used by more than a handful of people tend to rely on Client-Server based solutions. However, an
Access "front end" (the forms, reports, queries and VB code) can be used against a host of
database back ends, including JET (file-based database engine, used in Access by default),
Microsoft SQL Server, Oracle, and any other ODBC-compliant product.



Features
One of the benefits of Access from a programmer's perspective is its relative compatibility with
SQL (structured query language) queries may be viewed and edited as SQL statements, and
SQL statements can be used directly in Macros and VBA Modules to manipulate Access tables.
Users may mix and use both VBA and "Macros" for programming forms and logic and offers
object-oriented possibilities.
MSDE (Microsoft SQL Server Desktop Engine) 2000, a mini-version of MS SQL Server 2000, is
included with the developer edition of Office XP and may be used with Access as an alternative to
the Jet Database Engine.
P a g e | 3 4
Unlike a modern RDBMS, the Access and the Jet Engine implements database triggers and stored
procedures in a non-standard way. Stored Procedures are implemented in VBA, and Triggers are
only available from embedded Forms. Both Triggers and Stored procedures are only available to
applications built completely within the Access database management system. Client applications
built with VB or C++ are not able to access these features. Starting in MS Access 2007 (Jet 4.0),
there is a new syntax for creating queries with parameters, in a way that looks like creating stored
procedures, but these procedures are still limited to one statement per procedure. Microsoft
Access does allow forms to contain code that is triggered as changes are made to the underlying
table (as long as the modifications are done only with that form), and it is common to use pass-
through queries and other techniques in Access to run stored procedures in RDBMSs that support
these.
In ADP files (supported in MS Access 2007 and later), the database-related features are entirely
different, because this type of file connects to a MSDE or Microsoft SQL Server, instead of using
the Jet Engine. Thus, it supports the creation of nearly all objects in the underlying server (tables
with constraints and triggers, views, stored procedures and UDF-s). However, only forms, reports,
macros and modules are stored in the ADP file (the other objects are stored in the back-end
database).

DATABASE DESIGN

The general theme behind a database is to handle information as an integrated whole. A database
is a collection of interrelated data stored with minimum redundancy to serve many users quickly
and effectively. After designing the input and output, the analyst must concentrate on database
design or how data should be organized around user requirements. The general objective is to
make information access, easy, quick, inexpensive and flexible for other users. During database
design, the following objectives are concerned:-
Controlled redundancy
Easy to learn and use
More information and low cost
Accuracy
Integrity

P a g e | 3 5
DATA MODELING:
Table.Channaling_Appointments



Table.Medical_Treatments

Table.Companies_Maintenance

FieldName DataType Description
CompanyId Text
CompnyFullName Text
companyShortName Text
CompanyAddress Memo
ContactPerson Text
PhoneNumber Text
DiscountAllowed Text

Field Name Data Type Description
DoctorID Text
ChosenDate Date/Time
TokenNo Text
Specialization Text
ChannalingCharges Text
AppointmentDuration Text
ChosenDay Text
StartTime Date/Time
EndTime Date/Time
AppointmentStartTime Date/Time
AppointmentEndTime Date/Time
FirstName Text
LastName Text
ContactNo Text
TodaysDate Date/Time
FieldName DataType Description
TreatmentID Text
PatientID Text
FirstName Text
SurName Text
MedicineID Text
MedicineName Text
DateofIssue Date/Time
UnitPrice Text
Qty Text
Total Text
P a g e | 3 6

Table.Department_Maintenance


FieldName DataType Description
DepartmentID Text
DepartmentName Text
RoomRate Text
AdditionalNotes Memo


Table.Discharge_Maintenance


FieldName DataType Description
DischargeID Text
AdmissionID Text
PatientId Text
FirstName Text
SurName Text
AdmissionDate Date/Time
AdmissionTime Date/Time
DischargeDate Date/Time
DischargeTime Date/Time
AdditionalNotes Memo
Discharged Yes/No


TableDoctor_Visits


FieldName DataType Description
VisitID Autonumber
VisitDate Date/Time
VisitTime Date/Time
DoctorID Text
DoctorName Text
DoctorCharges Text
PatientID Text
PatientName Text
AdditionalNotes Memo


P a g e | 3 7
Table.Doctor_Maintenance

FieldName DataType Description
DoctorID Text
FirstName Text
SurName Text
Gender Text
DateofBirth Data/Time
NICNumber Text
Address Memo
Phone NoHome Text
PhoneNoMob Text
LicenceNo Text
Specialization Text
DoctorCatagory Text
ServiceCharge Text
ChannalingCharges Text
AppointmentDuration Text
ReferringCharges Text

Table Doctors_Schedules

FieldName DataType Descripction
ScheduleID Autonumber
DoctorID Text
MondayStart Time Date/Time
MondayEndTime Date/Time
TuesdayStartTime Date/Time
TuesdayEndTime Date/Time
WednesdayStart Time Date/Time
WednesdayEndTime Date/Time
ThursdayStart Time Date/Time
ThursdayEndTime Date/Time
FridayStart Time Date/Time
FridayEndTime Date/Time
SaturdayStart Time Date/Time
SaturdayEndTime Date/Time
SundayStart Time Date/Time
SundayEndTime Date/Time

P a g e | 3 8
Table .Guardians_Maintenance

FieldName DataType Description
GuardianID
Text
PatientID
Text
FirstName
Text
SurName
Text

Gender
Text

NICNumber
Text

Address Memo
PhoneNoHome
Text

PhoneNoMob
Text

Occupation
Text

RelationToPatient
Text



TableInpatient_Billing


FieldName DataType Description
InvoiceID Text
BillingDate Date/Time
AdmissionID Text
PatientID Text
PatientName Text
AccountType Text
TotalCost Text
Discount Text
TotalPayble Text
TotalPaidSoFar Text
BalanceOwing Text
AmountPaid Text
BillStatus Text
PaymentType Text
ChequeNo Text
CardNo Text
BankName Text
TotalReceived Text
Balance Text
P a g e | 3 9



TableInpatient_Payment_Details

FieldName DataType Description
OverallinBillID Text
AdmissionID Text
PatientID Text
FirstName Text
SurName Text
AccountType Text
AssignedDoctorID Text
DepartmentID Text
DepartmentName Text
WardNo Text
RoomID Text
AdmissionDate Text
TodaysDate Date/Time
LengthofStay Text
DoctorsCharges Text
MedicalTreatmentCharges Text
ServiceTreatmentCharges Text
RoomCharges Text
HospitalCharges Text
Total Text
Vat Text
Discount Text
NettTotal Text







P a g e | 4 0
Table.Inpatients_Admission

FieldName DataType Description
AdmissionID Text
PatientID Text
GuardianID Text
AdmissionDate Date/Time
AdmissionTime Date/Time
PatientStatus Text
ReasonForStatus Text
ReferredDoctorID Memo
ReferredDoctorName Text
AssignDoctorID Text
AssignDoctorName Text
DepartmentID Text
DepartmentName Text
WardID Text
WardNo Text
RoomID Text
AdditionalNotes Memo

Table.Inpatient_Maintenance

FieldName DataType Description
PatientID Text
FirstName Text
SurName Text
Gender Text
DateofBirth Date/Time
NicNumber Text
Address Memo
PhoneNoMob Text
PhoneNoHome Text
PatientOccupation Text
CivilStatus Text
AccountType Text
CompanyID Text
CompanyName Text
ModDate Date/Time

P a g e | 4 1
Table..Medical_Treatments_Out

FieldName DataType Description
TreatmentID Text
PatientID Text
FirstName Text
SurName Text
MedicineID Text
MedicineName Text
DateofIssue Date/Time
Unitprice Text
Qty Text
Total Text



Table.Medicines_maintenance

FieldName DataType description
MedicineID Text
MedicineName Text
DosageForm Text
UnitPrice Text
UnitInStock Text
ReorderLevel Text
AdditionalNotes Memo







P a g e | 4 2
Table..OutPatient_Billing

FieldName DaraType Description
InvoiceID Text
BillDate Date/Time
PatientID Text
PatientName Text
AccountType Text
TotalCost Text
Discount Text
TotalPayble Text
AmountPaid Text
BillStatus Text
PaymentType Text
ChequeNo Text
CardNo Text
BankName Text
TotalReceived Text
Balance Text
ModDate Date/Time











P a g e | 4 3

SCREENSHOT
SPLASH SCREEN



SPLASH PAGE CODING:
Option Explicit

Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
End Sub

Private Sub Form_Load()
' lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
' lblProductName.Caption = App.Title
End Sub

Private Sub Frame1_Click()
Unload Me
End Sub

Private Sub Timer1_Timer()
P a g e | 4 4
Static ictr As Integer
'Run the timer and check the condition
'when the condition is false
'stop the timer and disply the login form
If ictr <= 100 Then
ProgressBar1.Value = ictr
ictr = ictr + 1
Else
frmLogin.Show

Unload Me
End If
End Sub





LOGIN PAGE



LOGIN PAGE CODING:
Option Explicit
Dim rsLogin As ADODB.Recordset 'Creating a Recordset Variable
Dim iLoginFailure As Integer 'This variable will count the number of times the user's login is
unsuccessful.


P a g e | 4 5
Private Sub Form_Initialize()

Call Connection 'Calling the Connection Procedure.

'Creating a New Recordset To Be Used For Login Purposes Only
Set rsLogin = New ADODB.Recordset

With rsLogin
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.ActiveConnection = conn
.CursorLocation = adUseClient
End With

iLoginFailure = 1 ' When a login attempt is unsuccessful, I decrement this variable's value.

End Sub


Private Sub txtUsername_Change()

'This block of code will enable or disable the "Go" button accordingly

If txtUserName.Text = "" Then
cmdGo.Enabled = False
Else
cmdGo.Enabled = True
End If


End Sub

Private Sub txtUserName_keypress(KeyAscii As Integer)

'This block of code prevents the user from using "Copy-Paste" (Ctrl+C, Ctrl+V) functions.

If KeyAscii = 3 Or KeyAscii = 22 Or KeyAscii = 24 Then
KeyAscii = 0
ElseIf KeyAscii = 13 Then 'This is for using the Enter key
KeyAscii = 0
SendKeys "{Tab}"
End If

End Sub

Private Sub txtPassword_Keypress(KeyAscii As Integer)

'This block of code prevents the user from using "Copy-Paste" (Ctrl+C, Ctrl+V) functions.

If KeyAscii = 3 Or KeyAscii = 22 Or KeyAscii = 24 Then
KeyAscii = 0
ElseIf KeyAscii = 13 Then 'This is for using the Enter key
KeyAscii = 0
SendKeys "{Tab}"
P a g e | 4 6
Call cmdGO_Click
End If


End Sub

Private Sub cmdGO_Click()

If iLoginFailure <= 3 Then 'Checking If The User Is Still Allowed To Login

'Selecting the Related Login Record from the User_Account Table.
rsLogin.Open "select * from UserAccount where Username='" & txtUserName.Text & "'",
conn

With rsLogin


If .RecordCount = 0 Then 'This Means That There Is No Matching Record

iLoginFailure = iLoginFailure + 1 'Decrementing The Value Of i On Each
Unsuccessful Login Attempt
MsgBox "Sorry! Invalid User Name! Please Try Again!", vbCritical, "Invalid Login!"
txtUserName.BackColor = &H80000018 'Highlighting The Textbox With The Error
txtPassword.BackColor = &H80000005 'Highlighting The Textbox With The Error
txtUserName.Text = ""
txtUserName.SetFocus

End If

If .RecordCount <> 0 Then 'This Means That There Is A Matching Record
If txtPassword.Text = .Fields(6).Value Then 'Checking Password

If .Fields(4) = "Administrator" Then 'Checking Designation

'Passing Necessary Values To Global Variables

userName = .Fields(1).Value & " " & .Fields(2).Value
accessLevel = "Administrator"
userID = .Fields(0).Value
frmMDI.Show
Unload Me

ElseIf .Fields(4) = "Cashier" Then 'Checking Designation

'Passing Necessary Values To Global Variables
userName = .Fields(1).Value & " " & .Fields(2).Value
accessLevel = "Cashier"
userID = .Fields(0).Value
Unload Me
frmMDI.Show

ElseIf .Fields(4) = "Inpatient Staff" Then 'Checking Designation

'Passing Necessary Values To Global Variables
P a g e | 4 7
userName = .Fields(1).Value & " " & .Fields(2).Value
accessLevel = "Inpatient Staff"
userID = .Fields(0).Value
frmMDI.Show
Unload Me

ElseIf .Fields(4) = "Outpatient Staff" Then 'Checking Designation

'Passing Necessary Values To Global Variables
userName = .Fields(1).Value & " " & .Fields(2).Value
accessLevel = "Outpatient Staff"
userID = .Fields(0).Value
frmMDI.Show
Unload Me

ElseIf .Fields(4) = "Receptionist" Then 'Checking Designation

'Passing Necessary Values To Global Variables
userName = .Fields(1).Value & " " & .Fields(2).Value
accessLevel = "Receptionist"
userID = .Fields(0).Value
frmMDI.Show
Unload Me

End If

Else

'Error Mesage For Invalid Password
iLoginFailure = iLoginFailure + 1 'Decrementing The Value Of i On Each
Unsuccessful Login Attempt
MsgBox "Sorry! Invalid Password! Please Try Again!", vbCritical, "Invalid Login!"
txtPassword.BackColor = &H80000018 'Highlighting The Textbox With The Error
txtUserName.BackColor = &H80000005 'Highlighting The Textbox With The Error
txtPassword.Text = ""
txtPassword.SetFocus

End If

End If

.Close 'Closing Recordset

End With

Else
'Error Message If User's Login Attempt Is Unsuccesful On Three
'Consecutive Occasions
MsgBox "Sorry! You Have To Login Within Three Tries! Unloading...", vbCritical,
"Login Failure"
End

End If

P a g e | 4 8
End Sub


Private Sub cmdExit_Click()

'This block of code will be executed if the user decides to quit the application
'from the Login page

Dim ans As Variant
ans = MsgBox("Are You Sure You Wish To Quit The Application?", vbYesNo + vbQuestion,
"Quit Application?")

If ans = vbYes Then
End
End If

End Sub



MDI Main Page


P a g e | 4 9
MDI main page coding:

Option Explicit
Dim iExitReply As Integer 'This variable will hold the user's choice, once he has been asked
whether he wants to exit or not
Dim iLogOutReply As Integer 'This variable will hold the user's choice, once he has been asked
whether he wants to log out or not



Private Sub MDIForm_Load()

'In the following lines of code, I am checking the user access level
'and appropriately disabling certain restricted functions

lblDisplayTimeIn.Caption = DateTime.Time
If accessLevel = "Administrator" Then
lblDesignation.Caption = "Welcome, Administrator"
frmQuickLaunch.lblDesignation.Caption = "Administrator"

Call Enable_Controls 'Calling a User Defined Function In Order To Enable All
Components


ElseIf accessLevel = "Cashier" Then
lblDesignation.Caption = "Welcome, Cashier"
frmQuickLaunch.lblDesignation.Caption = "Cashier"

Call Enable_Controls 'Calling a User Defined Function In Order To Enable All
Components

lblShortcut(0).Enabled = False
lblShortcut(1).Enabled = False
lblShortcut(2).Enabled = False
lblShortcut(4).Enabled = False
lblShortcut(5).Enabled = False


mnuPatientAdmission.Enabled = False
mnuTreatment.Enabled = False
mnuDischargePatient.Enabled = False
mnuOutpatientsMaintenance.Enabled = False
mnuTreatments.Enabled = False
mnuChanneling.Enabled = False
mnuReports.Enabled = False
mnuManageUserAccounts.Enabled = False
mnuMaintenance.Enabled = False
mnuSearchEngine.Enabled = False
mnuBackupDatabase.Enabled = False

P a g e | 5 0


ElseIf accessLevel = "Receptionist" Then

lblDesignation.Caption = "Welcome, Receptionist"
frmQuickLaunch.lblDesignation.Caption = "Receptionist"

Call Enable_Controls 'Calling a User Defined Function In Order To Enable All
Components

lblShortcut(0).Enabled = False
lblShortcut(1).Enabled = False
lblShortcut(3).Enabled = False
lblShortcut(4).Enabled = False

mnuInpatients.Enabled = False
mnuOutpatients.Enabled = False
mnuPayments.Enabled = False
mnuReports.Enabled = False
mnuManageUserAccounts.Enabled = False
mnuMaintenance.Enabled = False
mnuBackupDatabase.Enabled = False


ElseIf accessLevel = "Inpatient Staff" Then
lblDesignation.Caption = "Welcome, Inpatient Staff"
frmQuickLaunch.lblDesignation.Caption = "Inpatient Staff"

Call Enable_Controls 'Calling a User Defined Function In Order To Enable All
Components

lblShortcut(1).Enabled = False
lblShortcut(2).Enabled = False
lblShortcut(3).Enabled = False
lblShortcut(4).Enabled = False
lblShortcut(5).Enabled = False

mnuOutpatients.Enabled = False
mnuChanneling.Enabled = False
mnuPayments.Enabled = False
mnuReports.Enabled = False
mnuMaintenance.Enabled = False
mnuManageUserAccounts.Enabled = False
mnuSearchEngine.Enabled = False
mnuBackupDatabase.Enabled = False

ElseIf accessLevel = "Outpatient Staff" Then

lblDesignation.Caption = "Welcome, Outpatient Staff"
frmQuickLaunch.lblDesignation.Caption = "Outpatient Staff"

Call Enable_Controls 'Calling a User Defined Function In Order To Enable All
Components

P a g e | 5 1
lblShortcut(0).Enabled = False
lblShortcut(2).Enabled = False
lblShortcut(3).Enabled = False
lblShortcut(4).Enabled = False
lblShortcut(5).Enabled = False

mnuInpatients.Enabled = False
mnuChanneling.Enabled = False
mnuPayments.Enabled = False
mnuReports.Enabled = False
mnuMaintenance.Enabled = False
mnuManageUserAccounts.Enabled = False
mnuSearchEngine.Enabled = False
mnuBackupDatabase.Enabled = False
End If

frmQuickLaunch.Show
lblDateTime.Caption = "Today is " & FormatDateTime(Now, vbLongDate)


BottomStatusBar.Panels(4).Text = userName
BottomStatusBar.Panels(5).Text = accessLevel


End Sub

Private Function Enable_Controls()

'This is a User Defined Function That Will Enable All The Components On The Screen.
'Here, I am running a For loop to include all the controls on the interface and then
'I enable them all, with one line of code

Dim ctrl As Control
On Error Resume Next
For Each ctrl In Controls
ctrl.Enabled = True
Next

End Function



Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)

'This event occurs when the user tries to quit the application by clicking the
'standard red cross button, on the top left hand corner of the interface

If UnloadMode = 0 Then
iExitReply = MsgBox(userName & ", Are You Sure You Wish To Exit The Application?",
vbYesNo + vbQuestion, "Exit Application?")
If iExitReply = vbNo Then
Cancel = 1
End If
End If
P a g e | 5 2

End Sub

Private Sub lblShortcut_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As
Single, Y As Single)

'Here, I am creating Rollover Effects For Each Button On The Shortcut Panel

Select Case (Index)
Case 0: 'Manage User Accounts Button
lblShortcut(0).ForeColor = &H800000
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = True
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

Case 1: 'Manage Inpatients Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H800000
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = True
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

Case 2: 'Manage Outpatients Button
P a g e | 5 3
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H800000
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = True
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

Case 3: 'Channeling Services Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H800000
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = True
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

Case 4: 'Reports Quick Launch Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H800000
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
P a g e | 5 4
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = True
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

Case 5: 'Search Engine Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H800000
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = True
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False


Case 6: 'Change Password Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H800000
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = True
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
P a g e | 5 5
lblShortcut(9).FontUnderline = False

Case 7: 'Log Off / Exit Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H800000
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = True
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

Case 8: 'Log Off Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H800000
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = True
lblShortcut(9).FontUnderline = False

Case 9: 'Exit Button
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
P a g e | 5 6
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H800000
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = True
End Select

End Sub


Private Sub imgRecordExplorer_MouseMove(Button As Integer, Shift As Integer, X As Single, Y
As Single)

'The Following Block Of Code Ensures That The Mouse Pointer
'Returns To Normal When It Is Not Over A Button

lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

End Sub


Private Sub imgUserAccount_MouseMove(Button As Integer, Shift As Integer, X As Single, Y
As Single)

'The Following Block Of Code Ensures That The Mouse Pointer
'Returns To Normal When It Is Not Over A Button

P a g e | 5 7
lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

End Sub

Private Sub mnuAbout_Click()
frmAbout.Show
End Sub

Private Sub mnuAddMedicalTreatment_Click()
frmAddMedicalTreatmentsOut.Show
End Sub

Private Sub mnuAddMedicalTreatments_Click()
frmAddMedicalTreatmentsIn.Show
End Sub

Private Sub mnuAddServiceTreatment_Click()
frmAddServiceTreatmentsOut.Show
End Sub

Private Sub mnuAddServiceTreatments_Click()
frmAddServiceTreatmentsIn.Show
End Sub

Private Sub mnuBackupDatabase_Click()
frmBackupDatabase.Show
End Sub

Private Sub mnuCalendar_Click()
frmCalendar.Show
End Sub

Private Sub mnuCascade_Click()
Me.Arrange vbCascade
End Sub
P a g e | 5 8

Private Sub mnuCloseAll_Click()
Me.Arrange vbCascade
End Sub

Private Sub mnuCorporateMaintenance_Click()
frmCompaniesMaintenance.Show
End Sub

Private Sub mnuCredits_Click()
frmCredits.Show
End Sub





Private Sub mnuEditMedicalTreatment_Click()
frmMedicalTreatmentsOut.Show
End Sub

Private Sub mnuEditMedicalTreatmentRecords_Click()
frmMedicalTreatmentsMaintenance.Show
End Sub

Private Sub mnuEditServiceTreatmentRecord_Click()
frmServiceTreatmentsMaintenance.Show
End Sub

Private Sub mnuEditServiceTreatmentRecords_Click()
frmServiceTreatmentsOut.Show
End Sub

Private Sub mnuHelpFile_Click()
'---Opening the Help Guide File with the Common Dialog Object
On Error GoTo e
Const cdlHelpPartialKey = &H105 ' Calls the search engine in Windows Help

CommonDialog.HelpCommand = cdlHelpPartialKey
CommonDialog.Action = 6
Exit Sub
e:
MsgBox Err.Description
'MsgBox "Error! The Help Guide does not exist!", vbCritical, "Help File Does Not Exist!"

End Sub

Private Sub mnuLogOff_Click()

iLogOutReply = MsgBox(userName & ", Are You Sure You Wish To Log Out Of Your
Account?", vbYesNo + vbQuestion, "Log Out?")
If iLogOutReply = vbYes Then
frmLogin.Show
Unload Me
P a g e | 5 9
End If

End Sub

Private Sub mnuMicrosoftMagnifier_Click() 'Opens Up The Magnifier Utility
On Error GoTo errcode
Dim a As Double
a = Shell("C:\WINDOWS\System32\magnify.exe", vbNormalFocus)
Exit Sub
errcode:
MsgBox "Unable to run Microsoft Magnifier on your computer", vbError, "Error Loading
Microsoft Magnifier!"
Resume Next
End Sub

Private Sub mnuMicrosoftNarrator_Click() 'Opens Up The Narrator Utility
On Error GoTo errcode
Dim a As Double
a = Shell("C:\WINDOWS\System32\narrator.exe", vbNormalFocus)
Exit Sub
errcode:
MsgBox "Unable to run Microsoft Narrator on your computer", vbError, "Error Loading
Microsoft Narrator!"
Resume Next
End Sub





Private Sub mnuRoomsMaintenance_Click()
frmRoomsMaintenance.Show
End Sub

Private Sub mnuSearchEngine_Click()
frmSearchEngine.Show
End Sub

Private Sub mnuSystemCalculator_Click() 'Opens Up The Calculator Utility
On Error GoTo errcode
Dim a As Double
a = Shell("C:\WINDOWS\System32\calc.exe", vbNormalFocus)
Exit Sub
errcode:
MsgBox "Unable to run the Calculator Utility on your computer", vbError, "Error Loading
Calculator!"
Resume Next
End Sub

Private Sub mnuSystemMediaPlayer_Click() 'Opens Up The System Media Player Utility
On Error GoTo errcode
Dim a As Double
a = Shell("C:\WINDOWS\System32\dvdplay.exe", vbNormalFocus)
Exit Sub
P a g e | 6 0
errcode:
MsgBox "Unable to run System Media Player on your computer", vbError, "Error Loading
System Media Player!"
Resume Next
End Sub

Private Sub mnuSystemNotepad_Click() 'Opens Up The Notepad Utility
On Error GoTo errcode
Dim a As Double
a = Shell("C:\WINDOWS\System32\notepad.exe", vbNormalFocus)
Exit Sub
errcode:
MsgBox "Unable to run the Notepad Utility on your computer", vbError, "Error Loading
Notepad!"
Resume Next
End Sub

Private Sub mnuTileHorizontally_Click()
Me.Arrange vbTileHorizontal
End Sub

Private Sub mnuTileVertically_Click()
Me.Arrange vbTileVertical
End Sub


Private Sub picTopNavigation_MouseMove(Button As Integer, Shift As Integer, X As Single, Y
As Single)

'The Following Block Of Code Ensures That The Mouse Pointer
'Returns To Normal When It Is Not Over A Button

lblShortcut(0).ForeColor = &H80000006
lblShortcut(1).ForeColor = &H80000006
lblShortcut(2).ForeColor = &H80000006
lblShortcut(3).ForeColor = &H80000006
lblShortcut(4).ForeColor = &H80000006
lblShortcut(5).ForeColor = &H80000006
lblShortcut(6).ForeColor = &H80000006
lblShortcut(7).ForeColor = &H80000006
lblShortcut(8).ForeColor = &H80000006
lblShortcut(9).ForeColor = &H80000006
lblShortcut(0).FontUnderline = False
lblShortcut(1).FontUnderline = False
lblShortcut(2).FontUnderline = False
lblShortcut(3).FontUnderline = False
lblShortcut(4).FontUnderline = False
lblShortcut(5).FontUnderline = False
lblShortcut(6).FontUnderline = False
lblShortcut(7).FontUnderline = False
lblShortcut(8).FontUnderline = False
lblShortcut(9).FontUnderline = False

End Sub
P a g e | 6 1

Private Sub lblShortcut_Click(Index As Integer)

'The following block of code illustrates which interfaces are displayed on click of
'each respective button

Select Case (Index)
Case 0: 'Manage Inpatients Button
Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact
with the recordset
frmInpatientsMaintenance.Show

Case 1: 'Manage Outpatients Button
frmOutpatientsMaintenance.Show

Case 2: 'Channeling Services Button
frmChannelingAppointments.Show

Case 3: 'Payments Button
frmPaymentOptions.Show

Case 4: 'Reports Quick Launch Button
frmReportsQuickLaunch.Show

Case 5: 'Search Engine Button
frmSearchEngine.Show

Case 6: 'Change Password Button
frmChangePassword.Show

Case 7: 'Log Off / Exit Button
frmTurnOff.Show
frmMDI.Enabled = False
Case 8: 'Log Off Button
iLogOutReply = MsgBox(userName & ", Are You Sure You Wish To Log Out Of Your
Account?", vbYesNo + vbQuestion, "Log Out?")
If iLogOutReply = vbYes Then
frmLogin.Show
Unload Me
End If

Case 9: 'Exit Button
iExitReply = MsgBox(userName & ", Are You Sure You Wish To Quit The
Application?", vbYesNo + vbQuestion, "Quit Application?")
If iExitReply = vbYes Then
End
End If

End Select

End Sub


Private Sub mnuChangePassword_Click()
P a g e | 6 2
frmChangePassword.Show
End Sub

Private Sub mnuCompanyMaintenance_Click()
frmCompaniesMaintenance.Show
End Sub

Private Sub mnuDepartmentsMaintenance_Click()
frmDepartmentsMaintenance.Show
End Sub

Private Sub mnuDischargePatient_Click()
frmDischargeDetailsMaintenance.Show
End Sub

Private Sub mnuDoctorScheduleMaintenance_Click()
frmDoctorScheduleMaintenance.Show
End Sub

Private Sub mnuDoctorsMaintenance_Click()
frmDoctorsMaintenance.Show
End Sub

Private Sub mnuDoctorsVisitMaintenance_Click()
frmDoctorVisitsMaintenance.Show
End Sub

Private Sub mnuDoctorVisitMaintenance_Click()
frmDoctorVisitsMaintenance.Show
End Sub

Private Sub mnuExit_Click()

If MsgBox(userName & ", Are You Sure You Wish To Quit The Application?", vbYesNo +
vbQuestion, "Quit Application?") = vbYes Then
End
End If

End Sub

Private Sub mnuGuardiansMaintenance_Click()
Call Guardians_Maintenance
Set frmGuardiansMaintenance.dgrdGuardiansInfo.DataSource = rsGuardiansMaintenance
frmGuardiansMaintenance.Show
End Sub

Private Sub mnuHopitalServicesMaintenance_Click()
frmServicesMaintenance.Show
End Sub

Private Sub mnuInpatientsMaintenance_Click()
Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact with
the recordset
frmInpatientsMaintenance.Show
P a g e | 6 3
End Sub

Private Sub mnuManageAppointments_Click()
frmChannelingAppointments.Show
End Sub

Private Sub mnuManagePatientBill_Click()
frmIPDOverallBilling.Show
End Sub

Private Sub mnuManagePatientsBill_Click()
frmOPDOverallBilling.Show
End Sub

Private Sub mnuManageUserAccounts_Click()
frmManageUserAccounts.Show
End Sub

Private Sub mnuMedicinesMaintenance_Click()
frmMedicinesMaintenance.Show
End Sub

Private Sub mnuOSearchPayments_Click()
frmSearchOutpatientPayments.Show
End Sub

Private Sub mnuOutpatientsMaintenance_Click()
frmOutpatientsMaintenance.Show
End Sub

Private Sub mnuRegisterAdmitPatient_Click()
Call Inpatients_Admission
frmAdmitPatient.Show
End Sub

Private Sub mnuSearchPayments_Click()
frmSearchPayments.Show
End Sub


Private Sub mnuViewOverallPatientBill_Click()
frmOPDOverallBilling.cmdSave.Enabled = False
frmOPDOverallBilling.cmdGoToPayments.Enabled = False
frmOPDOverallBilling.Show
End Sub

Private Sub mnuViewOveralPatientBill_Click()
frmIPDOverallBilling.cmdSave.Enabled = False
frmIPDOverallBilling.cmdGoToPayments.Enabled = False
frmIPDOverallBilling.Show
End Sub


Private Sub mnuWardsMaintenance_Click()
P a g e | 6 4
frmWardsMaintenance.Show
End Sub

'----------------------------REPORTS MDI---------------------------------------------------

Private Sub mnuAllCompaniesMasterReport_Click()
RptAllCompaniesMaster.Show
End Sub

Private Sub mnuAllDoctors_Click()
RptDoctorsMaster.Show
End Sub

Private Sub mnuAllDoctorsSchedulesMasterReport_Click()
RptAllDoctorsShedule.Show
End Sub

Private Sub mnuChannelingPatientsMasterReport_Click()
frmReportChannelingMaster.Show
End Sub

Private Sub mnuDepartmentsMasterReport_Click()
RptDepartmentMaster.Show
End Sub

Private Sub mnuDoctorsVisitsMasterReport_Click()
RptVisitingDoctorsShedule.Show
End Sub

Private Sub mnuIndividualDoctorsScheduleReport_Click()
RptAllDoctorsShedule.Show
End Sub

Private Sub mnuInpatientsInvoice_Click()
frmReportInpatientInvoice.Show
End Sub

Private Sub mnuInpatientsMasterReport_Click()
frmReportInpatientMaster.Show
End Sub

Private Sub mnuMedicalServicesMasterReport_Click()
RptMedicalServicesMaster.Show
End Sub

Private Sub mnuMedicinesMasterReport_Click()
RptMedicinesMaster.Show
End Sub

Private Sub mnuOutpatientsMasterReport_Click()
frmReportOutpatientMaster.Show
End Sub

Private Sub mnuPatientAdmissionMasterReport_Click()
P a g e | 6 5
frmReportPatientAdmission.Show
End Sub

Private Sub mnuPatientDischargeMasterReport_Click()
frmReportPatientDischarge.Show
End Sub

Private Sub mnuRoomsMasterReport_Click()
RptRoomsMaster.Show
End Sub

Private Sub mnuInpatientMedicines_Click()
frmReportInpatientMedicalTreatment.Show
End Sub

Private Sub mnuOutpatientsMedicines_Click()
frmReportOutpatientMedicalTreatments.Show
End Sub

Private Sub mnuInpatientsServices_Click()
frmReportInpatientServiceTreatments.Show
End Sub

Private Sub mnuOutpatientsServices_Click()
frmReportOutPatientPatientServiceTreatements.Show
End Sub

Private Sub mnuDoctorsChannelingSchedule_Click()
RptAllDoctorsShedule.Show
End Sub
Private Sub mnuIndividualCompanyOutpatients_Click()
RptIndividualCompanyOutpatients.Show
End Sub

Private Sub mnuIndividualCompanyInpatients_Click()
RptIndividualCompanyInpatients.Show
End Sub

Private Sub mnuInpatientsRevenueReports_Click()
frmReportInpatientRevenue.Show
End Sub

Private Sub mnuOutpatientsRevenueReports_Click()
frmReportOutpatientRevenue.Show
End Sub

Private Sub mnuDoctorEarningsReports_Click()
frmReportDoctorsEarnings.Show
End Sub

Private Sub mnuBillStatusReport_Click()
frmReportAging.Show
End Sub

P a g e | 6 6


Inpatient Maintenance Coding:
Option Explicit

Dim eachField As Control 'Declaring a Control Variable for all Fields
Dim eachButton As Control 'Declaring a Control Variable fot all Command Buttons

'The Following Boolean Variable is being used to determine
'if the data the user enters is valid or not
Dim Flag As Boolean

'The following Boolean Variable will determine if the Doctor's Date Of Birth
'entered by the user is valid
Dim dateFlag As Boolean

'The following variables will be used to autogenerate the Doctor ID
Dim iNumOfRecords As Integer 'This variable holds the number of records in the table
Dim strCode As String 'This variable will eventually hold the Doctor ID to be autogenerated


'The following variables will be used to autogenerate the Guardian ID to be
'displayed on the Guardians Maintenance form on form load
Dim iNumOfGuardians As Integer 'This variable holds the number of records in the table
P a g e | 6 7
Dim strDisplayID As String 'This variable will eventually hold the Guardian ID to be
autogenerated



Private Sub cboAccountType_Click() 'This function will manipulate other controls according to
the type of account

'The following block of code will disable the Company related fields if the
'Patient Account Type is "Individual"
If cboAccountType.ListIndex = 0 Then
lblCompanyID.Enabled = True
txtCompanyID.Enabled = True
lblCompanyName.Enabled = True
txtCompanyName.Enabled = True
cmdCompanySearchWizard.Enabled = True
Else
lblCompanyID.Enabled = False
txtCompanyID.Enabled = False
lblCompanyName.Enabled = False
txtCompanyName.Enabled = False
cmdCompanySearchWizard.Enabled = False
End If

End Sub

Private Sub cmdAddNew_Click() 'This function adds a new recordset into the database

enableAllFields 'Calling a Private Function To Enable All Fields
clearAllFields 'Calling a Private Function To Clear All Fields
disableAllButtons 'Calling a Private Function To Disable All Command Buttons

txtNICNumber.Text = "-" 'Since this textfield is not compulsory
txtPhoneMob.Text = "-" 'Since this textfield is not compulsory
txtPhoneHome.Text = "-" 'Since this textfield is not always compulsory


'Enabling the Save Command Button & Close Command Button
cmdSave.Enabled = True
cmdClose.Enabled = True


'Disabling the Company Related Records
lblCompanyID.Enabled = False
txtCompanyID.Enabled = False
lblCompanyName.Enabled = False
txtCompanyName.Enabled = False
cmdCompanySearchWizard.Enabled = False


Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact with
the recordset

'Generate Patient ID By Utilizing the Inpatients_Maintenance Table
P a g e | 6 8
With rsInpatientMaintenance

If .RecordCount = 0 Then 'If there are no records in the table

strCode = "INP0001"

Else

'Calculating the number of records and storing in a variable
iNumOfRecords = .RecordCount
iNumOfRecords = iNumOfRecords + 1 'incrementing the number by 1

'The following block of code will generate the ID according
'to the number of records in the Inpatients_Maintenance Table
If iNumOfRecords < 10 Then
strCode = "INP000" & iNumOfRecords
ElseIf iNumOfRecords < 100 Then
strCode = "INP00" & iNumOfRecords
ElseIf iNumOfRecords < 1000 Then
strCode = "INP0" & iNumOfRecords
ElseIf iNumOfRecords < 10000 Then
strCode = "INP" & iNumOfRecords
End If

End If

.Requery 'Requerying the Table

.AddNew 'Adding a new recordset

End With

'The following line of code will enter the autogenerated Patient ID
'into the Patient ID textfield
txtPatientID.Text = strCode

End Sub


Private Sub cmdClose_Click()

If MsgBox(userName & ", Are You Sure You Wish To Close This Interface?", vbYesNo +
vbQuestion, "Close Interface?") = vbYes Then
Unload Me
End If

End Sub

Private Sub cmdCompanySearchWizard_Click()

frmCompanySearchWizard.Show

End Sub

P a g e | 6 9
Private Sub cmdDelete_Click() 'This function will delete a record from the database

'Check for the record selection
If txtPatientID.Text = "" Then

MsgBox "Error! No Record Has Been Selected", vbCritical, "No Record Selected!"

Else

With rsInpatientMaintenance

'Confirm the Delete procedure with the user
If MsgBox("Are You Sure You Wish To Delete Patient ID " & txtPatientID.Text & "'s
Record?", vbYesNo + vbQuestion, "Delete Record?") = vbYes Then

.Delete 'Delete the record from the database

'Display Success Message
MsgBox "The Record Has Been Deleted Successfully!", vbInformation, "Successful
Delete Procedure!"

Form_Load 'Calling the Form_Load Procedure

clearAllFields 'Calling a Private Function To Clear All Fields

Else

'Display 'Delete Procedure Cancelled' Message
MsgBox "The Delete Procedure Was Cancelled!", vbExclamation, "Delete Procedure
Cancelled!"

Form_Load 'Calling the Form_Load Procedure

clearAllFields 'Calling a Private Function To Clear All Fields

End If

.Requery 'Requerying the Table

End With

End If

End Sub

Private Sub cmdLaunchInpatientSearch_Click() 'This function is fired when the Launch Inpatient
Search Wizard Command Button is Clicked. It opens up the Inpatient Search Wizard


enableAllFields 'Calling a Private Function To Enable All Fields
enableAllButtons 'Calling a Private Function To Enable All Command Buttons

cmdSave.Enabled = False 'Disabling the Save Command Button

P a g e | 7 0
frmInpatientSearchWizard.Show 'Displays the Doctor Search Wizard

'Disabling the "Step" Buttons
cmdStep1.Enabled = False
cmdStep3.Enabled = False

End Sub

Private Sub cmdSave_Click() 'This function will save all the user's data in the database


'Checking if the Phone Number (Home) textfield and the Phone Number (Mob) textfield are
empty
If txtPhoneHome.Text = "-" And txtPhoneMob.Text = "-" Then
txtPhoneHome.BackColor = &H80000018 'Highlighting the textfield in a different colour
txtPhoneMob.BackColor = &H80000018 'Highlighting the textfield in a different colour
MsgBox "Error! Both Phone Number Textfields Cannot Be Empty! At Least One Has To Be
Provided!", vbCritical, "Error In Phone Numbers!"
Exit Sub
Else
txtPhoneHome.BackColor = &H80000004 'Bringing the textfield BackColour back to
normal
txtPhoneMob.BackColor = &H80000004 'Bringing the textfield BackColour back to normal
End If


'Checking the return value of the function that validates the user's data
If textfieldsValidations = False Then


'Validation To Ensure That The NIC Number is 10 Characters In Length
If txtNICNumber.Text <> "-" Then
If Len(txtNICNumber.Text) <> 10 Then
MsgBox "Error! The NIC Number Has To Consist Of 10 Characters!", vbCritical,
"Error In NIC Number!"
txtNICNumber.BackColor = &H80000018 'Highlighting the textfield in a different
colour
Exit Sub
Else
txtNICNumber.BackColor = &H80000004
End If
End If


'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length
If txtPhoneHome.Text <> "-" Then
If Len(txtPhoneHome.Text) > 15 Then
MsgBox "Error! The Phone No (Home) Textfield Cannot Consist Of More Than 15
Digits!", vbCritical, "Error In Phone No (Home)!"
txtPhoneHome.BackColor = &H80000018
Exit Sub
Else
txtPhoneHome.BackColor = &H80000004
End If
P a g e | 7 1
End If


'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length
If txtPhoneMob.Text <> "-" Then
If Len(txtPhoneMob.Text) > 15 Then
MsgBox "Error! The Phone No (Mob) Textfield Cannot Consist Of More Than 15
Digits!", vbCritical, "Error In Phone No (Mob)!"
txtPhoneMob.BackColor = &H80000018
Exit Sub
Else
txtPhoneMob.BackColor = &H80000004
End If
End If


'Validation To Ensure That The Patient Occupation is not Greater than 30 Characters in
Length
If Len(txtPatientOccupation.Text) > 30 Then
MsgBox "Error! The Patient Occupation Textfield Cannot Consist Of More Than 30
Characters", vbCritical, "Error In Patient Occupation!"
txtPatientOccupation.BackColor = &H80000018
Exit Sub
Else
txtPatientOccupation.BackColor = &H80000004
End If


With rsInpatientMaintenance

'Making sure that the user wants to save the record
If MsgBox("Are You Sure You Wish To Save This Record?", vbYesNo + vbQuestion,
"Save This Record?") = vbYes Then

'The following block of if else conditions ensure that no
'textfield will be completely blank when saving in the database.
'This has been done in order to avoid errors.
If txtNICNumber.Text = "" Then
txtNICNumber.Text = "-"
End If

If txtPhoneMob.Text = "" Then
txtPhoneMob.Text = "-"
End If

If txtPhoneHome.Text = "" Then
txtPhoneHome.Text = "-"
End If

If txtCompanyID.Text = "" Then
txtCompanyID.Text = "-"
End If

If txtCompanyName.Text = "" Then
P a g e | 7 2
txtCompanyName.Text = "-"
End If

strPatientID = txtPatientID.Text

'Save the user-entered data into the recordset
.Fields(0) = txtPatientID.Text
.Fields(1) = txtFirstName.Text
.Fields(2) = txtSurname.Text
.Fields(3) = cboGender.Text
.Fields(4) = dtpDateOfBirth.Value
.Fields(5) = txtNICNumber.Text
.Fields(6) = txtAddress.Text
.Fields(7) = txtPhoneHome.Text
.Fields(8) = txtPhoneMob.Text
.Fields(9) = txtPatientOccupation.Text
.Fields(10) = cboCivilStatus.Text
.Fields(11) = cboAccountType.Text
.Fields(12) = txtCompanyID.Text
.Fields(13) = txtCompanyName.Text

.Update

'Display Success Message
MsgBox "The Record Was Saved Successfully! You Will Now Be Taken To Step 2!",
vbInformation, "Succesful Save Procedure!"


loadGuardiansMaintenance 'Calling a public function to prepare the Guardians
Maintenance form

Unload Me

frmGuardiansMaintenance.Show

Else

'Display 'No Modifications' Message
MsgBox "No Modifications Have Taken Place!", vbInformation, "No Modifications!"

.CancelUpdate 'Cancel the Save Procedure

Form_Load 'Calling the Form_Load Procedure

clearAllFields 'Calling a Private Function To Clear All Fields

End If

.Requery 'Requerying the Table

End With

End If

P a g e | 7 3

End Sub

Private Function loadGuardiansMaintenance()

frmGuardiansMaintenance.enableAllFields 'Calling a Private Function To Enable All Fields
frmGuardiansMaintenance.clearAllFields 'Calling a Private Function To Clear All Fields
frmGuardiansMaintenance.disableAllButtons 'Calling a Private Function To Disable All
Command Buttons

frmGuardiansMaintenance.txtNICNumber.Text = "-" 'Since this textfield is not compulsory
frmGuardiansMaintenance.txtPhoneMob.Text = "-" 'Since this textfield is not always
compulsory
frmGuardiansMaintenance.txtPhoneHome.Text = "-" 'Since this textfield is not always
compulsory


'Enabling the Save Command Button
frmGuardiansMaintenance.cmdSave.Enabled = True

'Disbaling the Search Frame
frmGuardiansMaintenance.lblCriteria.Enabled = False
frmGuardiansMaintenance.cboSearchType.Enabled = False
frmGuardiansMaintenance.lblSearchText.Enabled = False
frmGuardiansMaintenance.txtSearch.Enabled = False


Call Guardians_Maintenance 'Calling the Guardians_Maintenance Procedure to interact with
the recordset

'Generate Guardian ID By Utilizing the Guardians_Maintenance Table
With rsGuardiansMaintenance

If .RecordCount = 0 Then 'If there are no records in the table

strDisplayID = "GRD0001"

Else

'Calculating the number of records and storing in a variable
iNumOfGuardians = .RecordCount
iNumOfGuardians = iNumOfGuardians + 1 'incrementing the number by 1

'The following block of code will generate the ID according
'to the number of records in the Guardians_Maintenance Table
If iNumOfGuardians < 10 Then
strDisplayID = "GRD000" & iNumOfGuardians
ElseIf iNumOfGuardians < 100 Then
strDisplayID = "GRD00" & iNumOfGuardians
ElseIf iNumOfGuardians < 1000 Then
strDisplayID = "GRD0" & iNumOfGuardians
ElseIf iNumOfGuardians < 10000 Then
strDisplayID = "GRD" & iNumOfGuardians
End If
P a g e | 7 4

End If

.Requery 'Requerying the Table

.AddNew 'Adding a new recordset

End With

'The following line of code will enter the autogenerated Guardian ID
'into the Guardian ID textfield
frmGuardiansMaintenance.txtGuardianID.Text = strDisplayID

frmGuardiansMaintenance.txtPatientID.Text = strPatientID 'Global Variable

frmGuardiansMaintenance.dgrdGuardiansInfo.Enabled = False

End Function


Private Sub cmdStep2_Click()

Call Guardians_Maintenance

With rsGuardiansMaintenance

.MoveFirst

Do While .EOF = False

If .Fields(1).Value = txtPatientID.Text Then

'Entering the values in the particular record into the fields on the interface
frmGuardiansMaintenance.txtGuardianID.Text = .Fields(0).Value
frmGuardiansMaintenance.txtPatientID.Text = .Fields(1).Value
frmGuardiansMaintenance.txtFirstName.Text = .Fields(2).Value
frmGuardiansMaintenance.txtSurname.Text = .Fields(3).Value
frmGuardiansMaintenance.cboGender.Text = .Fields(4).Value
frmGuardiansMaintenance.txtNICNumber.Text = .Fields(5).Value
frmGuardiansMaintenance.txtAddress.Text = .Fields(6).Value
frmGuardiansMaintenance.txtPhoneHome.Text = .Fields(7).Value
frmGuardiansMaintenance.txtPhoneMob.Text = .Fields(8).Value
frmGuardiansMaintenance.txtOccupation.Text = .Fields(9).Value
frmGuardiansMaintenance.txtRelationToPatient.Text = .Fields(10).Value
Exit Do

Else

.MoveNext

End If

Loop

P a g e | 7 5
End With


'Enabling / Diabling the Navigation Buttons as necessary
frmGuardiansMaintenance.cmdFirst.Enabled = False
frmGuardiansMaintenance.cmdLast.Enabled = True
frmGuardiansMaintenance.cmdPrevious.Enabled = False
frmGuardiansMaintenance.cmdNext.Enabled = True

'Enabling the Update Button
frmGuardiansMaintenance.cmdUpdate.Enabled = True


'Enabling the "Step" Buttons
frmGuardiansMaintenance.cmdStep1.Enabled = True
frmGuardiansMaintenance.cmdStep3.Enabled = True

frmGuardiansMaintenance.enableAllFields

Unload Me

frmGuardiansMaintenance.Show



End Sub



Private Sub cmdUpdate_Click() 'This function will update a record after the user has edited it


'Checking if the Phone Number (Home) textfield and the Phone Number (Mob) textfield are
empty
If txtPhoneHome.Text = "-" And txtPhoneMob.Text = "-" Then
txtPhoneHome.BackColor = &H80000018 'Highlighting the textfield in a different colour
txtPhoneMob.BackColor = &H80000018 'Highlighting the textfield in a different colour
MsgBox "Error! Both Phone Number Textfields Cannot Be Empty! At Least One Has To Be
Provided!", vbCritical, "Error In Phone Numbers!"
Exit Sub
Else
txtPhoneHome.BackColor = &H80000004 'Bringing the textfield BackColour back to
normal
txtPhoneMob.BackColor = &H80000004 'Bringing the textfield BackColour back to normal
End If



'Checking the return value of the function that validates the user's data
If textfieldsValidations = False Then


'Validation To Ensure That The NIC Number is 10 Characters In Length
If txtNICNumber.Text <> "-" Then
P a g e | 7 6
If Len(txtNICNumber.Text) <> 10 Then
MsgBox "Error! The NIC Number Has To Consist Of 10 Characters!", vbCritical,
"Error In NIC Number!"
txtNICNumber.BackColor = &H80000018 'Highlighting the textfield in a different
colour
Exit Sub
Else
txtNICNumber.BackColor = &H80000004
End If
End If


'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length
If txtPhoneHome.Text <> "-" Then
If Len(txtPhoneHome.Text) > 15 Then
MsgBox "Error! The Phone No (Home) Textfield Cannot Consist Of More Than 15
Digits!", vbCritical, "Error In Phone No (Home)!"
txtPhoneHome.BackColor = &H80000018
Exit Sub
Else
txtPhoneHome.BackColor = &H80000004
End If
End If


'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length
If txtPhoneMob.Text <> "-" Then
If Len(txtPhoneMob.Text) > 15 Then
MsgBox "Error! The Phone No (Mob) Textfield Cannot Consist Of More Than 15
Digits!", vbCritical, "Error In Phone No (Mob)!"
txtPhoneMob.BackColor = &H80000018
Exit Sub
Else
txtPhoneMob.BackColor = &H80000004
End If
End If


'Validation To Ensure That The Patient Occupation is not Greater than 30 Characters in
Length
If Len(txtPatientOccupation.Text) > 30 Then
MsgBox "Error! The Patient Occupation Textfield Cannot Consist Of More Than 30
Characters", vbCritical, "Error In Patient Occupation!"
txtPatientOccupation.BackColor = &H80000018
Exit Sub
Else
txtPatientOccupation.BackColor = &H80000004
End If


With rsInpatientMaintenance

'Making sure that the user wants to update the record
P a g e | 7 7
If MsgBox("Are You Sure You Wish To Update This Record?", vbYesNo + vbQuestion,
"Update This Record?") = vbYes Then

'The following block of if else conditions ensure that no
'textfield will be completely blank when saving in the database.
'This has been done in order to avoid errors.
If txtNICNumber.Text = "" Then
txtNICNumber.Text = "-"
End If

If txtPhoneMob.Text = "" Then
txtPhoneMob.Text = "-"
End If

If txtPhoneHome.Text = "" Then
txtPhoneHome.Text = "-"
End If

If txtCompanyID.Text = "" Then
txtCompanyID.Text = "-"
End If

If txtCompanyName.Text = "" Then
txtCompanyName.Text = "-"
End If


'Save the user-entered data into the recordset
.Fields(0) = txtPatientID.Text
.Fields(1) = txtFirstName.Text
.Fields(2) = txtSurname.Text
.Fields(3) = cboGender.Text
.Fields(4) = dtpDateOfBirth.Value
.Fields(5) = txtNICNumber.Text
.Fields(6) = txtAddress.Text
.Fields(7) = txtPhoneHome.Text
.Fields(8) = txtPhoneMob.Text
.Fields(9) = txtPatientOccupation.Text
.Fields(10) = cboCivilStatus.Text
.Fields(11) = cboAccountType.Text
.Fields(12) = txtCompanyID.Text
.Fields(13) = txtCompanyName.Text

.Update

'Display Success Message
MsgBox "The Record Was Updated Successfully!", vbInformation, "Succesful Update
Procedure"


Form_Load 'Calling the Form_Load Procedure

clearAllFields 'Calling a Private Function To Clear All Fields

P a g e | 7 8
Else

'Display 'No Modifications' Message
MsgBox "No Modifications Have Taken Place!", vbInformation, "No Modifications!"

.CancelUpdate 'Cancel the Update Procedure

Form_Load 'Calling the Form_Load Procedure

clearAllFields 'Calling a Private Function To Clear All Fields

End If

.Requery 'Requerying the Table

End With

End If

End Sub

Public Sub Form_Load()

Call Connection 'Calling the Connection Procedure

disableAllFields 'Calling a Private Function To Disable All Fields
disableAllButtons 'Calling a Private Function To Disable All Command Buttons

'Enabling the First Button and the Last Button
cmdFirst.Enabled = True
cmdLast.Enabled = True

'Enabling the Add New Button & the Close Button
cmdAddNew.Enabled = True
cmdClose.Enabled = True

'Enabling the LaunchDoctorSearch Wizard Button
cmdLaunchInpatientSearch.Enabled = True


End Sub

Private Function disableAllFields() 'This function will disable all fields on the interface

On Error Resume Next
For Each eachField In Me.Controls 'Running a Loop through all the Controls

'The following If Condition will disable all TextBoxes and ComboBoxes
If TypeOf eachField Is TextBox Or TypeOf eachField Is ComboBox Then
eachField.Enabled = False
End If

Next

P a g e | 7 9
dtpDateOfBirth.Enabled = False 'Disabling the Date Of Birth Date Time Picker


End Function



Public Function enableAllFields() 'This function will enable all fields on the interface


On Error Resume Next
For Each eachField In Me.Controls 'Running a Loop through all the Controls

'The following If Condition will enable all TextBoxes and ComboBoxes
If TypeOf eachField Is TextBox Or TypeOf eachField Is ComboBox Then
eachField.Enabled = True
End If

Next

dtpDateOfBirth.Enabled = True 'Enabling the Date Of Birth Date Time Picker

End Function


Private Function disableAllButtons() 'This function will disable all command buttons on the
interface

On Error Resume Next
For Each eachButton In Me.Controls 'Running a Loop through all the Controls

'The following If Condition will disable all Command Buttons
If TypeOf eachButton Is CommandButton Then
eachButton.Enabled = False
End If

Next

End Function



Private Function enableAllButtons() 'This function will enable all command buttons on the
interface


On Error Resume Next
For Each eachButton In Me.Controls 'Running a Loop through all the Controls

'The following If Condition will enable all Command Buttons
If TypeOf eachButton Is CommandButton Then
eachButton.Enabled = True
End If

P a g e | 8 0
Next

'Disabling the Step 1 Button
cmdStep1.Enabled = False

End Function


Public Function clearAllFields() 'This function will clear all fields on the interface


On Error Resume Next
For Each eachField In Me.Controls 'Running a Loop through all the Controls

'The following If Condition will clear all TextBoxes
If TypeOf eachField Is TextBox Then
eachField.Text = ""
End If

Next

'The following lines will set the normal display values of the Gender
'ComboBox, Doctor Category ComboBox and the Date Of Birth Date Time Picker
cboGender.Text = "----------SELECT-----------"
cboCivilStatus.Text = "----------SELECT-----------"
cboAccountType.Text = "----------SELECT-----------"
dtpDateOfBirth.Value = "4/14/2008"

End Function


Private Sub cmdFirst_Click() 'This function will Navigate to the First Record

'Enabling / Diabling the Navigation Buttons as necessary
cmdFirst.Enabled = False
cmdLast.Enabled = True
cmdPrevious.Enabled = False
cmdNext.Enabled = True

'Enabling the Update Button and the Delete Button
cmdUpdate.Enabled = True
cmdDelete.Enabled = True

'Enabling the "Step" Buttons
cmdStep2.Enabled = True


'Enabling the Company Search Wizard
cmdCompanySearchWizard.Enabled = True

Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact with
the recordset

With rsInpatientMaintenance
P a g e | 8 1


.MoveFirst 'Moving to the first record

'Entering the values in the particular record into the fields on the interface
txtPatientID.Text = .Fields(0).Value
txtFirstName.Text = .Fields(1).Value
txtSurname.Text = .Fields(2).Value
cboGender.Text = .Fields(3).Value
dtpDateOfBirth.Value = .Fields(4).Value
txtNICNumber.Text = .Fields(5).Value
txtAddress.Text = .Fields(6).Value
txtPhoneHome.Text = .Fields(7).Value
txtPhoneMob.Text = .Fields(8).Value
txtPatientOccupation.Text = .Fields(9).Value
cboCivilStatus.Text = .Fields(10).Value
cboAccountType.Text = .Fields(11).Value
txtCompanyID.Text = .Fields(12).Value
txtCompanyName.Text = .Fields(13).Value

End With

enableAllFields 'Calling a Private Function To Enable All Fields

End Sub


Private Sub cmdPrevious_Click() 'This function will Navigate to the Previous Record

With rsInpatientMaintenance


.MovePrevious 'Moving to the previous record

'If the user reaches the first record, display a message box
'to inform the user of this
If .BOF Then
MsgBox "This is the first record!", vbInformation, "First Record"
.MoveFirst
End If

'Entering the values in the particular record into the fields on the interface
txtPatientID.Text = .Fields(0).Value
txtFirstName.Text = .Fields(1).Value
txtSurname.Text = .Fields(2).Value
cboGender.Text = .Fields(3).Value
dtpDateOfBirth.Value = .Fields(4).Value
txtNICNumber.Text = .Fields(5).Value
txtAddress.Text = .Fields(6).Value
txtPhoneHome.Text = .Fields(7).Value
txtPhoneMob.Text = .Fields(8).Value
txtPatientOccupation.Text = .Fields(9).Value
cboCivilStatus.Text = .Fields(10).Value
cboAccountType.Text = .Fields(11).Value
P a g e | 8 2
txtCompanyID.Text = .Fields(12).Value
txtCompanyName.Text = .Fields(13).Value

End With

cmdNext.Enabled = True 'Enabling the Next Button
cmdLast.Enabled = True 'Enabling the Last Button

'Enabling the Update Button and the Delete Button
cmdUpdate.Enabled = True
cmdDelete.Enabled = True

'Enabling the "Step" Buttons
cmdStep2.Enabled = True


'Enabling the Company Search Wizard
cmdCompanySearchWizard.Enabled = True

enableAllFields 'Calling a Private Function To Enable All Fields

End Sub


Private Sub cmdNext_Click() 'This function will Navigate to the Next Record

With rsInpatientMaintenance

.MoveNext 'Moving to the Next Record

'If the user reaches the last record, display a message box
'to inform the user of this
If .EOF Then
MsgBox "This is the last record!", vbInformation, "Last Record"
.MoveLast
End If

'Entering the values in the particular record into the fields on the interface
txtPatientID.Text = .Fields(0).Value
txtFirstName.Text = .Fields(1).Value
txtSurname.Text = .Fields(2).Value
cboGender.Text = .Fields(3).Value
dtpDateOfBirth.Value = .Fields(4).Value
txtNICNumber.Text = .Fields(5).Value
txtAddress.Text = .Fields(6).Value
txtPhoneHome.Text = .Fields(7).Value
txtPhoneMob.Text = .Fields(8).Value
txtPatientOccupation.Text = .Fields(9).Value
cboCivilStatus.Text = .Fields(10).Value
cboAccountType.Text = .Fields(11).Value
txtCompanyID.Text = .Fields(12).Value
txtCompanyName.Text = .Fields(13).Value

End With
P a g e | 8 3

cmdPrevious.Enabled = True 'Enabling the Previous Button
cmdFirst.Enabled = True 'Enabling the First Button

'Enabling the Update Button and the Delete Button
cmdUpdate.Enabled = True
cmdDelete.Enabled = True

'Enabling the "Step" Buttons
cmdStep2.Enabled = True


'Enabling the Company Search Wizard
cmdCompanySearchWizard.Enabled = True

enableAllFields 'Calling a Private Function To Enable All Fields

End Sub


Private Sub cmdLast_Click() 'This function will Navigate to the Last Record

'Enabling / Diabling the Navigation Buttons as necessary
cmdLast.Enabled = False
cmdFirst.Enabled = True
cmdPrevious.Enabled = True
cmdNext.Enabled = False

'Enabling the Update Button and the Delete Button
cmdUpdate.Enabled = True
cmdDelete.Enabled = True

'Enabling the "Step" Buttons
cmdStep2.Enabled = True


'Enabling the Company Search Wizard
cmdCompanySearchWizard.Enabled = True

Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact with
the recordset

With rsInpatientMaintenance

.Requery

.MoveLast 'Moving to the last record

'Entering the values in the particular record into the fields on the interface
txtPatientID.Text = .Fields(0).Value
txtFirstName.Text = .Fields(1).Value
txtSurname.Text = .Fields(2).Value
cboGender.Text = .Fields(3).Value
dtpDateOfBirth.Value = .Fields(4).Value
P a g e | 8 4
txtNICNumber.Text = .Fields(5).Value
txtAddress.Text = .Fields(6).Value
txtPhoneHome.Text = .Fields(7).Value
txtPhoneMob.Text = .Fields(8).Value
txtPatientOccupation.Text = .Fields(9).Value
cboCivilStatus.Text = .Fields(10).Value
cboAccountType.Text = .Fields(11).Value
txtCompanyID.Text = .Fields(12).Value
txtCompanyName.Text = .Fields(13).Value

End With

enableAllFields 'Calling a Private Function To Enable All Fields

End Sub



Private Function textfieldsValidations() As Boolean 'This function will validate all fields

Flag = True 'Setting the Flag variable to True
dateFlag = True 'Setting the dateFlag variable to True

'Checking if the First Name textfield is empty
If txtFirstName.Text = "" Then
txtFirstName.BackColor = &H80000018 'Highlighting the textfield in a different colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
txtFirstName.BackColor = &H80000004 'Bringing the textfield BackColour back to normal
End If

'Checking if the Surname textfield is empty
If txtSurname.Text = "" Then
txtSurname.BackColor = &H80000018 'Highlighting the textfield in a different colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
txtSurname.BackColor = &H80000004 'Bringing the textfield BackColour back to normal
End If

'Checking if the user has made a selection in the Gender ComboBox
If cboGender.Text = "" Then
cboGender.BackColor = &H80000018 'Highlighting the ComboBox in a different colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
cboGender.BackColor = &H80000004 'Bringing the ComboBox BackColour back to
normal
End If

'Checking if the Date Of Birth is valid
If dtpDateOfBirth.Value = "4/14/2008" Then
'Displaying an error message, asking the user to alter the date accordingly
MsgBox "The Date You Have Provided Is Incorrect! Please Check Your Date!", vbCritical,
"Incorrect Date"
dateFlag = False 'Setting the dateFlag variable to False to indicate invalid data
P a g e | 8 5
End If

'Checking if the Address textfield is empty
If txtAddress.Text = "" Then
txtAddress.BackColor = &H80000018 'Highlighting the textfield in a different colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
txtAddress.BackColor = &H80000004 'Bringing the textfield BackColour back to normal
End If

'Checking if the Patient Occupation textfield is empty
If txtPatientOccupation.Text = "" Then
txtPatientOccupation.BackColor = &H80000018 'Highlighting the textfield in a different
colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
txtPatientOccupation.BackColor = &H80000004 'Bringing the textfield BackColour back to
normal
End If

'Checking if the user has made a selection in the Civil Status ComboBox
If cboCivilStatus.Text = "" Then
cboCivilStatus.BackColor = &H80000018 'Highlighting the ComboBox in a different
colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
cboCivilStatus.BackColor = &H80000004 'Bringing the ComboBox BackColour back to
normal
End If

'Checking if the user has made a selection in the Account Type ComboBox
If cboAccountType.Text = "" Then
cboAccountType.BackColor = &H80000018 'Highlighting the ComboBox in a different
colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
cboAccountType.BackColor = &H80000004 'Bringing the ComboBox BackColour back to
normal
End If

'If the user chooses 'Corporate' from the Account Type ComboBox
If cboAccountType.ListIndex = 0 Then
'Checking if the Channeling Charges textfield is empty
If txtCompanyID.Text = "" Then
txtCompanyID.BackColor = &H80000018 'Highlighting the textfield in a different colour
txtCompanyName.BackColor = &H80000018 'Highlighting the textfield in a different
colour
Flag = False 'Setting the Flag variable to False to indicate invalid data
Else
txtCompanyID.BackColor = &H80000004 'Bringing the textfield BackColour back to
normal
txtCompanyName.BackColor = &H80000004 'Bringing the textfield BackColour back to
normal
End If
P a g e | 8 6
End If


'Here, I am checking the state of the Flag variable and if it is False, I am displaying a
'Message Box to instruct the user to enter data into all highlighted textfields.
'The Save procedure will also be cancelled
If Flag = False Then
MsgBox "Error! Please Fill-in The Highlighted Textfields! They Are Compulsory!",
vbCritical, "Please Fill Highlighted Textfields"
textfieldsValidations = True 'Passing values to the Save procedure
ElseIf dateFlag = False Then
textfieldsValidations = True 'Passing values to the Save procedure
Else
textfieldsValidations = False 'Passing values to the Save procedure
End If

End Function



Private Sub tmrErrMsg_Timer()

Static i As Integer

If i < 200000 Then 'Validation Msg Viewing Time Period
picInvalidDataMsg.Visible = False
picInvalidKeypressMsg.Visible = False
picInvalidKeyMsg.Visible = False
picInvalidTypingMsg.Visible = False
tmrErrMsg.Enabled = False
Else
i = i + 1
End If

End Sub


Private Sub txtPhoneHome_GotFocus() 'This procedure will ensure that the textfield is empty
when the user types in it.

If txtPhoneHome.Text = "-" Then
txtPhoneHome.Text = ""
End If

End Sub

Private Sub txtPhoneHome_LostFocus() 'This procedure will ensure that the textfield is not
empty when the user is not typing in it.

If txtPhoneHome.Text = "" Then
txtPhoneHome.Text = "-"
End If

End Sub
P a g e | 8 7


Private Sub txtPhoneMob_GotFocus() 'This procedure will ensure that the textfield is empty
when the user types in it.

If txtPhoneMob.Text = "-" Then
txtPhoneMob.Text = ""
End If

End Sub

Private Sub txtPhoneMob_LostFocus() 'This procedure will ensure that the textfield is not empty
when the user is not typing in it.

If txtPhoneMob.Text = "" Then
txtPhoneMob.Text = "-"
End If

End Sub

'This procedure will ensure that the textfield is empty when the user types in it.
Private Sub txtNICNumber_GotFocus()

If txtNICNumber.Text = "-" Then
txtNICNumber.Text = ""
End If

End Sub

Private Sub txtNICNumber_LostFocus() 'This procedure will ensure that the textfield is not
empty when the user is not typing in it.

If txtNICNumber.Text = "" Then
txtNICNumber.Text = "-"
End If

End Sub

Private Sub txtPhoneHome_KeyPress(KeyAscii As Integer)

'Keypress Validation to allow only digits

If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then
ElseIf KeyAscii = vbKeySpace Then
ElseIf KeyAscii = vbKeyBack Then
Else
picInvalidKeypressMsg.Top = 3360 'Validation Note View
picInvalidKeypressMsg.Visible = True
tmrErrMsg.Enabled = True
KeyAscii = 0
End If

End Sub

P a g e | 8 8

Private Sub txtPhoneMob_KeyPress(KeyAscii As Integer)

'Keypress Validation to allow only digits

If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then
ElseIf KeyAscii = vbKeySpace Then
ElseIf KeyAscii = vbKeyBack Then
Else
picInvalidKeypressMsg.Top = 3840 'Validation Note View
picInvalidKeypressMsg.Visible = True
tmrErrMsg.Enabled = True
KeyAscii = 0
End If

End Sub


Private Sub txtNICNumber_KeyPress(KeyAscii As Integer)

'Keypress Validation to allow only digits

If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then
ElseIf KeyAscii = Asc("X") Then
ElseIf KeyAscii = Asc("x") Then
ElseIf KeyAscii = Asc("V") Then
ElseIf KeyAscii = Asc("v") Then
ElseIf KeyAscii = vbKeySpace Then
ElseIf KeyAscii = vbKeyBack Then
Else
picInvalidTypingMsg.Top = 5760 'Validation Note View
picInvalidTypingMsg.Visible = True
tmrErrMsg.Enabled = True
KeyAscii = 0
End If

End Sub


Private Sub txtFirstName_KeyPress(KeyAscii As Integer)

'Keypress Validation to allow only alphabets

If KeyAscii >= Asc("a") And KeyAscii <= Asc("z") Then
ElseIf KeyAscii >= Asc("A") And KeyAscii <= Asc("Z") Then
ElseIf KeyAscii = vbKeySpace Then
ElseIf KeyAscii = vbKeyBack Then
Else
picInvalidDataMsg.Top = 3840 'Validation Note View
picInvalidDataMsg.Visible = True
tmrErrMsg.Enabled = True
KeyAscii = 0
End If

P a g e | 8 9
End Sub


Private Sub txtSurname_KeyPress(KeyAscii As Integer)

'Keypress Validation to allow only alphabets

If KeyAscii >= Asc("a") And KeyAscii <= Asc("z") Then
ElseIf KeyAscii >= Asc("A") And KeyAscii <= Asc("Z") Then
ElseIf KeyAscii = vbKeySpace Then
ElseIf KeyAscii = vbKeyBack Then
Else
picInvalidDataMsg.Top = 4320 'Validation Note View
picInvalidDataMsg.Visible = True
tmrErrMsg.Enabled = True
KeyAscii = 0
End If

End Sub


Private Sub txtPatientOccupation_KeyPress(KeyAscii As Integer)

'Keypress Validation to allow only alphabets

If KeyAscii >= Asc("a") And KeyAscii <= Asc("z") Then
ElseIf KeyAscii >= Asc("A") And KeyAscii <= Asc("Z") Then
ElseIf KeyAscii = vbKeySpace Then
ElseIf KeyAscii = vbKeyBack Then
Else
picInvalidKeyMsg.Top = 4320 'Validation Note View
picInvalidKeyMsg.Visible = True
tmrErrMsg.Enabled = True
KeyAscii = 0
End If

End Sub
P a g e | 9 0



P a g e | 9 1


P a g e | 9 2



P a g e | 9 3



P a g e | 9 4



P a g e | 9 5



P a g e | 9 6



P a g e | 9 7



P a g e | 9 8


CONCLUSION
The HOSPITAL MANAGEMENT SYSTEM is a great improvement over the manual system
using case fields and paper. The computerization of the system has sped up the process. In the
current system, the front office managing is very slow. The hospital managing system was
thoroughly checked and tested with dummy data and thus is found to be very reliable.
ADVANTAGES
It is fast, efficient and reliable
Avoids data redundancy and inconsistency
Very user-friendly
Easy accessibility of data
Number of personnel required is considerably less
Provides more security and integrity to data

FUTURE ENHANCEMENTS
The proposed system is Hospital Management System. We can enhance this system by
including more facilities like online whole system, inpatient room allotment for the admitted
patients and the stock details of medicines in the pharmacy.
Providing such features enable the users to include more comments into the system.


P a g e | 9 9

BIBLIOGRAPHY

Books
A Complete Guide to Programming in Visual Basic .Net
-Michael McMillian
A Complete Visual Basic 6 Training Course: How to Programme: Package
-Harvey M deitel,Paul j deitel,Tem R Neito
Advanced Programming Using Visual Basic: Version 6.0
-Julia Case Bradley
Access 2007 Power Programming with VBA
-Allen G Taylor
Advanced MS Visual Basic
-Peter Morris
Site Address
www.associatedcontent.com
www.members.tripod.com
www.vbcodesource.com

You might also like