You are on page 1of 105

D OCUMENTATION : C ARE N C URE

Project On
Hospital Management System

Submitted by

Name: Aasiya Amin

Registration #: 227086

Date of Submission: 07-04-2004

Under the guidance of: Mr. Arshid Hussain


B.E. (Electronics & Communication).

_______________A-Levels________________

CNC © Aasiya Amin i DOEACC A-Levels Project


Care N Cure
(CNC)
(Project Title)

Start Date: July 7, 2003

End Date: March 3, 2004

Name of the Coordinator (Guide): Mr. Arshid Hussain


B.E. (Electronics & Communication)

Names of Developer: Aasiya Amin

Date of Submission: 07-04-2004

Submitted in partial fulfillment of the requirements for qualifying DOEACC ‘A’ Levels

CNC © Aasiya Amin ii DOEACC A-Levels Project


Forwarding Letter

Executive Director
DOEACC Society
6, CGO Complex,
Lodhi Road,
New Delhi – 110003

Subject: Submission of Project Report


Level ‘A’
Registration No. 227086
Sir,

I am submitting my ‘A’ Level Project for evaluation. Details of my


Registration and postal address, etc. are as under:

Name : Aasiya Amin


Parentage : M.A. Bhat
Address : Rozabal Khanyar
Srinagar – 190003
J & K, India.
Phone No. : 0194-2477880
E-mail : aasiya_amin@yahoo.com

Thanking you.

Yours faithfully,
Aasiya Amin

CNC © Aasiya Amin iii DOEACC A-Levels Project


Acknowledgement

I have benefited a lot from the feedback and suggestions given to me by

Mr. Arshid Hussain Sesia Consulting Web site and my friends.

CNC © Aasiya Amin iv DOEACC A-Levels Project


CNC © Aasiya Amin v DOEACC A-Levels Project
DOEACC

CERTIFICATE

This is to certify that this report titled Care N Cure embodies the original work

done by Aasiya Amin (Registration# 227086) in partial fulfillment of ‘A’ Levels


course requirement at DOEACC under my direct supervision and guidance.

Coordinator:
Arshid Hussain
B. E. (Electronics & Communication)
Specialization in C/C++ under Unix System
Work Experience: About 8 years
Address: Karan Nagar, Srinagar (J & K) Dated: 07-04-2004

CNC © Aasiya Amin vi DOEACC A-Levels Project


Table of Contents

# Description Page #
1 Introduction ---------------------------------------------------------------------- 1

2 Goals to be achieved ------------------------------------------------------------ 3

3 Project Initiation Note ----------------------------------------------------------- 4

4 Project Plan ----------------------------------------------------------------------- 5

5 System Development Life Cycle ----------------------------------------------- 7

6 Methods used for Maintenance and Evaluation ---------------------------- 9

7 Development Environment ----------------------------------------------------- 12

8 Data Flow Diagram -------------------------------------------------------------- 13

9 E – R Diagram -------------------------------------------------------------------- 16

10 Structure Chart ------------------------------------------------------------------ 17

11 Database Schema ---------------------------------------------------------------- 18

12 Test Report ------------------------------------------------------------------------ 20

13 Program Listings ----------------------------------------------------------------- 22


Database Script …………………………………………………………….. 22
Project File ……………………………………………………………………. 25
Main Form ……………………………………………………………………. 26
Login Form …………………………………………………………………… 29
Main Navigation Form ……………………………………………………… 32
Album Navigation Form …………………………………………………… 37
Data Entry for Album Form ………………………………………………. 39
Title Entry Form …………………………………………………………….. 47
Song Entry Form ……………………………………………………………. 58
Song Search by First Line Form …………………………………………. 72
Report Centre Form ………………………………………………………… 75
General Dialog Form ……………………………………………………….. 82
Favorite Song Search Form ……………………………………………….. 83
User Administration Form ………………………………………………… 88
The Main Standard Module ………………………………………………. 93
Reports ……………………………………………………………………….. 96
Audio Management Library System Help (ALMS Help) …………….. 97
14 Suggested Enhancements ------------------------------------------------------ 98

15 Conclusion------------------------------------------------------------------------- 99

16 Instructions for Executing Project --------------------------------------------- 100

CNC © Aasiya Amin vii DOEACC A-Levels Project


Introduction

Medical profession is one of the most honored professions. Due to changing

atmosphere and new diseases, the job is becoming more complex and difficult. So

this profession also needs some of backup, which can help in identifying disease,

and history of the patient for the eradication of disease.

There is one dimension where computers play an important part. This is the

“CARE N CURE” system, which includes clinical laboratories and pathological

investigations as well. Thus, one sees that is a whole plethora of computer

applications in medicines, surgery, laboratory management, patient care and most

importantly in the development of human resources.

The main problem of the present system in the hospital is that it is still

managed manually. This manual management takes a lot of time in effort. This

problem can be reduced by introducing a simple software. Our motive of making

project is to automate the existing system so that the time can be saved.

It is our sincere hope that this project namely “CARE N CURE” system will

find acceptance in the medical profession.

CNC © Aasiya Amin 1 DOEACC A-Levels Project


Scope Of The Project

Computer science is rapidly advancing field and is hard to predict where it

is heading. Researchers at universities and industrial research labs are constantly

thinking of new ideas, some of which go nowhere but some of which become the

corner stone of future products and have massive impact on the industry and

users telling which in turns out to be easier to do in hindsight than in real time.

When MS-Dos was introduced as an operating system no one had predicted that it

would lead to development of graphical and user-friendly windows operating

system.

The system is developed for hospital; it reduces lots of documentation,

paper work and also saves lots of energy and time. The system is being developed

with the object to eliminate big files and forms and to organize the information

effectively and systematically. It reduces not only paper work but maintains huge

data with least effort. It reduces the clerical work.

CNC © Aasiya Amin 2 DOEACC A-Levels Project


Goals To Be Achieved

1. Automation (Computerization) of the system will save the unnecessary effort i.e it

reduces paper work and maintains huge data with least efforts.

2. The system has GUI thus completely user-friendly and easy to operate even by a

naïve or a parametric user.

3. It reduces the probability of mistake occurrence which oftenly occur during data

entry.

4. User can access various types of information with in minutes with the help of

computers.

5. To store information of each and every person separately.

6. To deliver particular patients information using queries and searching with the help

of software.

7. It lightens the burden of many employees in hospital and maintains the record of

hospital in an ordered manner.

8. Provision for generating various statistical reports.

9. To provide patient details in an integrated manner so that all his information is

connected thus reducing redundant data.

10. To provide safe and secure data.

CNC © Aasiya Amin 3 DOEACC A-Levels Project


Project Initiation Note

Client: Gousia Hospital,


Khanyar
Near Ploice Station

Project Name: CARE N CURE (CNC)

Effort (person-months): 8 months Duration (Calendar days): 240 days

Quality Reviewer: Mr. Arshad Hussain

Initiated by: Aasiya Amin Date: 07—07-2003

CNC © Aasiya Amin 4 DOEACC A-Levels Project


Project Plan

 Title & scope of project

Title: Care N Cure


Scope: Automation of Hospital Management System.
Project Code: 070-7-037
Initial Activity: Project Plan
Final activity: Project Walkthrough

 Client Details
Client Name: Gousia Hospital.
Address: Khanyar, Near Police Station.

 Outputs or deliverables for the project

# Item Requirements Planned Date Actual Date


1 Software 2 Copies 09-08-2003 11-03-2004
2 Documents 2 Copy 21-08-2003 15-03-2004

 Resource requirements

# Resource Name Why would you Where would you How long would you need
need the get the resource the resource
resource from
1 H/w (A personal For Personal Throughout the
Computer having at construction construction phase of
least 200 MHz of the system the project as well as
processor, 128 MB during the walkthrough
RAM and 1 GB free
Disk space,
Windows based
virus free, with a
CD-RW Drive,
preferable with a
floppy drive)
2 S/W (Microsoft For Personal Throughout the
Visual Studio.Net) construction construction phase of
the project as well as
during the walkthrough
3 MSDN Help For further Personal Through-out the
reference and construction phase of

CNC © Aasiya Amin 5 DOEACC A-Levels Project


# Resource Name Why would you Where would you How long would you need
need the get the resource the resource
resource from
sample codes the project
4 Books on Visual For additional Personal Through-out the
Basic.Net, SQL, information construction phase of
Microsoft Access the project

 Risks identified in the project

# Risk Probability Severity Action plan


(%) (%)
1 Defects in the 90 100 Discuss the problems that may be
end product faced during integration with the
due to Coordinator. Find out information about
problems integrating different modules from
faced during books and MSDN help. In order to
integration ensure that database connectivity
information does not need to be
changed on each and every form, create
a single component that contains the
connectivity information and use the
same component in Windows Forms.
2 Difference in 80 15 Discuss the naming conventions with
standards the Coordinator.
followed, such
as naming
conventions

 Task List

# Task
1. Creating the database and database objects
2. Creating the necessary reusable components and testing them
3. Creating Windows forms
4. Designing reports
5. Creating Help files

CNC © Aasiya Amin 6 DOEACC A-Levels Project


System Development Life Cycle

To develop this project, different models like prototyping, RAD, JAD etc. were looked at. It was decided to
follow traditional waterfall or System Development Life Cycle. The reasons for using this model were
many. Firstly this model is the one that is followed by the most. Therefore the success rate is high. Besides
that having first hand experience in dealing with the existing system, there was more knowledge about user
requirements. Hence not much need for user interaction.

This is a traditional systems development method. It is five-step life cycle:

1. Systems Planning
2. Systems Analysis
3. Systems Design
4. Systems Implementation
5. Systems Maintenance

Planning

The main objective of this phase is to clearly identify the problem (problem definition. A preliminary
investigation report is produced at the end of this phase. A project can go ahead after this stage only when it
is approved.

CNC © Aasiya Amin 7 DOEACC A-Levels Project


Analysis

This is fact-finding process. It involves gathering the facts and analyzing them to develop a specific plan,
known as Systems Requirement Document. All the functions of the existing system are analyzed to
recommend the necessary improvements.

Design

In this phase a design is developed which suits the requirements specified in the systems requirement
documents. The design is documented and the end report, known as the design specification, is submitted to
the client.

Implementation

During this phase, a complete system is developed and delivered. It involves a post implementation
evaluation to make sure that the system is working properly.

Maintenance

Changes are made to fix the problems identified by the end users.

CNC © Aasiya Amin 8 DOEACC A-Levels Project


Methods used for Maintenance and Evaluation

Proper protocols will be followed to document the system and the findings. The reason for this is that it will
help in tracking/ evaluating the system and will also be helpful in updating/ expanding or even maintaining
the system.

The methods that will be followed to document the system are:

 DFD
 ERD
 Structure Chart
 Module Specification

Data Flow Diagram (DFD)

Data flow diagrams represent the flow of data in a system. The four entities that must be represented in a
DFD are:

 Data Flows — Movement of data in the system


 Data Stores — Data repositories for data that is not moving
 Processes — Transforms of incoming data flow(s) to outgoing data flow(s)
 External Entities — Sources or destinations outside the specified system boundary

Data Flow External Entity Process Data Store Repository

E-R Diagram

The Entity – Relationship (E-R) data model is based on a perception of a real world that consists of a
collection of basic objects called entities and of relationships among these objects. An entity is a thing or
object in the real world that is distinguishable from other objects e.g. each person is an entity, bank accounts
can be considered to be entities. Entities are described in database by a set of attributes. A relationship is an

CNC © Aasiya Amin 9 DOEACC A-Levels Project


association among several entities. The set of all entities of the same type and the set of all relationship are
termed as an entity set and relationship set respectively.

The overall structure of a database can be expressed graphically by an E-R diagram, which is built up from
the following components:

 Rectangle — which represents entity sets


 Ellipse — which represents attributes
 Diamond — which represents relationships among entity sets
 Lines — which link attributes to entity sets and entity sets to relationships

Rectangle Ellipse Diamond Line

Structure Chart

The three main features of structure chart are:

1. The modules are shown in rectangular boxes.

2. Arrowed lines represent the control relationships between modules.

3. The communication between modules is shown by small arrows with a circle at the tail of the arrow
shaft.

Module Specification

A module is a collection of program statements with three basic attributes:

1. An input — what it receives from the module that invokes it.

2. An output — what it returns to the module that invokes it.

3. A function — what is does to its input to produce its output.

CNC © Aasiya Amin 10 DOEACC A-Levels Project


Development Environment

Development Tool

Since the System is to be developed for Windows platform, therefore, the best-suited development tool
available is Microsoft Visual Basic 6.0. Data Management is done using Microsoft Access as well as Oracle
SQL. The can be used both in Standalone Environment as well as in Network Environment. For that reason
for users of Standalone System Microsoft Access is available and for users of Network Environment Oracle
SQL is available.

Data Access Technology

We have vide range of Data Access Technologies available which are suitable for vide range of
environments. But the most powerful technology available today is ActiveX Data Object (ADO) technology,
which is meant for both standalone as well as network environment. Since Visual Basic has inbuilt support
for ADO technology, so I am using this technology in the system.

CNC © Aasiya Amin 11 DOEACC A-Levels Project


Data Flow Diagram

Context Diagram

Artist Input Artist

Director Input Director

Producer Input Producer

Music Dir Input Music Dir

Lyrists Input Lyrists

Rec Company Input Rec Company


Details Entry:
Language Input Title, Song, Album Language
Search / Query
Reports
Type Input Type

Song Type Input Song Type

Raga Input Raga

Category Input Category

Banner Input Banner

Remarks Input Remarks

CNC © Aasiya Amin 12 DOEACC A-Levels Project


Data Flow Diagram for Album, Title and Songs

Input Data
Input Data For Album Input Data

Apply
Validation
Rules

Retrieve
Input Data Records

Validate Input
Data

CNC © Aasiya Amin 13 DOEACC A-Levels Project


Data Flow Diagram to Search a Song using Title as input

Input Title to
Input Title Search

Apply
Validation
Rules

Retrieve Generate
Data Source Records Report

CNC © Aasiya Amin 14 DOEACC A-Levels Project


E-R Diagram

Station Code
Code
Album ID

Type
1
Album Contain
Signatory
No. s
Album No
Recording
Company Year of
Manufacture

Detail ID Film Based

M Name
Product Year
Album Details Producer

Banner 1 Director

First Line
Category
Song ID
Remarks
Song Type

Raga
Approved

Cut Album Content Contain


M s
Side
Language

Duration
Artist1
Music Dir
Artist2

Lyrists
Artist3

CNC © Aasiya Amin 15 DOEACC A-Levels Project


Structure Chart

Splash

Main Window

Login Dialog

Navigation Window

Data Entry Song Entry Report


Window Window Window

Data Entry Song Entry Report


Window Window Window

Year-wise Selected Film-wise Selected Selected Choice


Song Report Lyricist Song Report Composer Singer Songs
Window Report Window Report Report Report
Window Window Window Window

CNC © Aasiya Amin 16 DOEACC A-Levels Project


Database Schema

AlbumDetails
Patients
Name Type Meaning
Name Type Meaning
DetailID Number Detail ID
CardNo Text Card No
AlbumID Number Album ID
PtName Text Patient’s Name
FilmBased Number Film Based or not
PtParentage Text Patient’s Parentage
Name Text Name of Album/Film
PtAddress Text Patient’s Address
Producer Text Producer
Age Text Patient’s Age
Director Text Director
Sex Text Patient’s Gender
Banner Text Under Banner of
PtType Text Patient’s Type
ProductYear Date Year of Production
EDate Date Patient’s Entry Date

AlbumContent
Artist
Name Type Meaning
Name Type Meaning
SongID Number Song ID
Numbe
DetailID Number Detail ID ArtistID Artist ID
r
FirstLine Text First Line of Song ArtistName Text Name of Artist
Category Text Category of Song
Remarks Text Remarks about Song
Raga Text Raga Banner
Language Text Language of Song
Name Type Meaning
Artist1 Text Artist # 1
Numbe
BannerID Banner ID
Artist2 Text Artist # 2 r
Artist3 Text Artist # 3 Banner Text Banner

Lyrics Text Lyricists


MusicDir Text Music Director
Duration Number Duration of Song Category
Side Text # Of Side Name Type Meaning
Cut Number # Of Cuts Numbe
CategoryID Category ID
Approved Text Approved or not r
Category Text Category of Song
SongType Text Type of Song
Director

CNC © Aasiya Amin 17 DOEACC A-Levels Project


Name Type Meaning Raga
Numbe Name Type Meaning
DirectorID Director ID
r
Numbe
Director Text Name of Director RagaID Raga ID
r
RagaDetails Text About Raga

Lang
Name Type Meaning RecCompany
Numbe Name Type Meaning
LanguageID Language ID
r
Numbe Recording Company
Language Text Language of Song RecCompanyID
r ID
RecCompany Text Recording Company

Login
Name Type Meaning Remarks
UserName Text User ID Name Type Meaning

Password Text Password Numbe


RemarksID Remarks ID
r
Remarks Text Remarks about Song

Lyrics
Name Type Meaning SongType
Numbe
LyricsID Lyricists ID Name Type Meaning
r
Lyrics Text Name of Lyricists Numbe
SongTypeID Song Type ID
r
SongType Text Type of Song

MusicDir
Name Type Meaning Type
Numbe
MusirDirID Music Director ID Name Type Meaning
r
MusirDir Text Music Director Type Text Type of Song Quality

Producer
Name Type Meaning
Numbe
ProducerID Producer ID
r
Producer Text Name of Producer

CNC © Aasiya Amin 18 DOEACC A-Levels Project


Test Report

The application needs very little effort from the user to enter data, and hence avoids data entry mistakes to a
large extent. I have used user-friendly controls as much as possible, such as, Combo Boxes, Check Boxes,
Option Boxes, and Spinners etc. The field where date is to be entered, the user has to only select the date
from the calendar attached with the date control. Lot of work is done through mouse. There is very less
chance of Data Entry Errors.

Following Table Lists down any possible Data Entry Errors from user’s end and way of rectification of the
error.

# Path Input Output Actual Result

Form: Logon
1. If a wrong user name and Any invalid An error message An error
password is entered, an user name and message
error message should be password
displayed
2. If in all 3 attempts a wrong Any invalid An error message in An error
user name and password is user name and first two attempts. message in first
specified, an error should password, Third time, a two attempts.
be displayed and the then click the message Third time, a
application should be Login button “Unauthorized message
terminated. three times access. Aborting…” “Unauthorized
access.
Aborting…”
3. If a valid user name and User Name: Navigation Form Navigation Form
password is provided, it Admin
should display the Password:
Navigation Form Admin
Form: Data Entry Album Form
1. Enter invalid number for Enter “12A” in Error – “Invalid Error – “Invalid
Album #, Album Code, any of the Data. Please Re- Data. Please Re-
Signatory # and Station Field and enter” enter”
Code press Tab
2. Enter valid number for Enter “123” in -- --
Album#, Album Code, any of Field
Signatory # and Station and press Tab
Code
Form: Data Enter Song Form
1. Enter invalid Side # Enter “A” in Error – “Invalid Error – “Invalid
Side field and Value for this Field” Value for this

CNC © Aasiya Amin 19 DOEACC A-Levels Project


# Path Input Output Actual Result
press Tab Field”
2. Enter valid Side # Enter “2” in -- --
Side field and
press Tab

Test Procedure Review

# Areas of concern Result


1. Test cases have been identified and listed with their expected OK
results
2. Acceptable criteria from expected results have been specified. OK
3. Error handling has been tested. OK

Program Listings

CNC © Aasiya Amin 20 DOEACC A-Levels Project


The Database Script
--Creating the Database
create database ALMS
go
--Creating the Album Table
create table Album (
AlbumID number(4) primary key,
STNCode char(7) not null,
Code char(10) not null,
Type char(3) not null,
AlbumNo varchar2(10) not null,
Year date,
RecCompany varchar2(40),
SignatoryNo varchar2(10) )
go
--Creating the AlbumDetail Table
create table AlbumDetail (
DetailID number(4) primary key,
AlbumID number(4) references Album(AlbumID),
FilmBased number(1) not null,
Name varchar2(40),
Producer varchar2(40),
Director varchar2(40),
Banner varchar2(40),
ProductYear date )
go
--Creating the AlbumContent Table
create table AlbumContent (
SongID number(4) primary key,
DetailID number(4) references AlbumDetail(DetailID),
FirstLine varchar2(255),
Category varchar2(30),
Remarks varchar2(255),
Raga varchar2(40),
Language varchar2(40),
Artist1 varchar2(40),
Artist2 varchar2(40),
Artist3 varchar2(40),
Lyrics varchar2(40),
MusicDir varchar2(40),
Duration number(2),
Side varchar2(12),
Cut number(3),
Approved varchar2(12),
SongType varchar2(40) )
go

--Creating the Artist Table

CNC © Aasiya Amin 21 DOEACC A-Levels Project


create table Artist (
ArtistID number(4) not null unique,
ArtistName varchar2(40) )
go
--Creating the Banner Table
create table Banner(
BannerID number(4) not null unique,
Banner varchar2(40) )
go
--Creating the Category Table
create table Category (
CategoryID number(4) not null unique,
Category varchar2(40) )
go
--Creating the Director Table
create table Director (
DirectorID number(4) not null unique,
Director varchar2(40) )
go
--Creating the Lang Table
create table Lang (
LanguageID number(4) not null unique,
Language varchar2(40) )
go
--Creating the Login Table
create table Login (
UserName varchar2(20) not null unique,
Password varchar2(20) )
go
--Creating the Lyrics Table
create table Lyrics (
LyricsID number(4) not null unique,
Lyrics varchar2(40) )
go
--Creating the MusicDir Table
create table MusicDir (
MusicDirID number(4) not null unique,
MusicDir varchar2(40) )
go

CNC © Aasiya Amin 22 DOEACC A-Levels Project


--Creating the Producer Table
create table Producer (
ProducerID number(4) not null unique,
Producer varchar2(40) )
go
--Creating the Raga Table
create table Raga (
RagaID number(4) not null unique,
RagaDetails varchar2(40) )
go
--Creating the RecCompany Table
create table RecCompany (
RecCompID number(4) not null unique,
RecCompany varchar2(40) )
go
--Creating the Remarks Table
create table Remarks (
RemarksID number(4) not null unique,
Remarks varchar2(255) )
go
--Creating the SongType Table
create table SongType (
SongTypeID number(4) not null unique,
SongType varchar2(40) )
go
--Creating the Type Table
create table Type (
Type varchar2(7) )
go

CNC © Aasiya Amin 23 DOEACC A-Levels Project


Project File: AudioLab.vbp
This file is the main Visual Basic Project File containing all modules. It includes 14 Form Modules, One Standard Module
and 3 Report Modules.
Type=Exe
Reference=*\G{00020430-0000-0000-C000-
000000000046}#2.0#0#C:\WINDOWS\SYSTEM\stdole2.tlb#OLE Automation
Reference=*\G{00000201-0000-0010-8000-00AA006D2EA4}#2.1#0#C:\PROGRAM
FILES\COMMON FILES\SYSTEM\ADO\msado15.dll#Microsoft ActiveX Data Objects
2.1 Library
Reference=*\G{78E93843-85FD-11D0-8487-
00A0C90DC8A9}#1.0#0#C:\WINDOWS\SYSTEM\MSDBRPT.DLL#Microsoft Data Report
Designer v6.0
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCT2.OCX
Form=Login.frm
Form=ALMain.frm
Form=ALTitle.frm
Module=modALMain; modALMain.bas
Form=Dialog.frm
Form=Main.frm
Form=AddUser.frm
Form=Album.frm
Form=SongEntry.frm
Form=TitleEntry.frm
Form=ReportCentre.frm
Form=SongSearchReport.frm
Form=AlbumNavigator.frm
Designer=rptSongSearch.Dsr
Reference=*\G{6B263850-900B-11D0-9484-
00A0C91110ED}#1.0#0#C:\WINDOWS\SYSTEM\MSSTDFMT.DLL#Microsoft Data
Formatting Object Library
Designer=rptFilmWise.Dsr
Designer=rptGeneral.Dsr
Form=SongSearchFL.frm
Form=About.frm
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX
IconForm="frmLogin"
Startup="frmALTitle"
HelpFile=""
Command32=""
Name="AudioLab"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="Aay Ech Enterprises"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

CNC © Aasiya Amin 24 DOEACC A-Levels Project


Main Form
This is application’s MDI Form, having a Menu Bar containing menus for performing different
tasks, a Toolbar containing Iconic buttons for common tasks and a Status bar showing status of
various operations, messages, date, time etc. All the other forms are child form of this form.

Main Form

Form Properties
Property Value

Name ALMain

Caption Audio Library Management System

Controls used in the form


Control for Control Type Properties Values

Tool Bar Toolbar Name tbrAL

To Show Status Statusbar Name stbAL

Images for Toolbar ImageList Name imlAL

To Provide On-line Help CommonDialog Name cdlgALHelp

Code
Private Sub MDIForm_Load()
Dim i As Byte

Me.Left = (Screen.Width - Me.Width) / 2


Me.Top = (Screen.Height - Me.Height) / 2
Me.mnuAlbum.Enabled = False
For i = 1 To 11

CNC © Aasiya Amin 25 DOEACC A-Levels Project


Me.tbrAL.Buttons(i).Enabled = False
Next i

blnLogin = False
getConnection
App.HelpFile = App.Path & "\ALMS Help.hlp"
cdlgALHelp.HelpCommand = &H3&
cdlgALHelp.HelpFile = App.Path & "\ALMS Help.hlp"
End Sub

Private Sub MDIForm_Resize()


frmLogin.Left = (Me.ScaleWidth - frmLogin.Width) / 2
frmLogin.Top = (Me.ScaleHeight - frmLogin.Height) / 2
End Sub

Private Sub mnuAlbumEntry_Click()


frmAlbum.Show
End Sub

Private Sub mnuAlbumSongEntry_Click()


On Error Resume Next
frmSongEntry.Show
End Sub

Private Sub mnuAlbumTitleEntry_Click()


frmTitleEntry.Show
End Sub

Private Sub mnuFileAddNewUser_Click()


Dim rsTemp As New adodb.Recordset
Dim strPass, strQuery As String

strPass = InputBox("Enter Administrator's Password", "Checking


Authorization...")
If strPass <> "" Then
strQuery = "Select * from Login where Username = 'Admin' and
Password = " + "'" + strPass + "'"
If rsTemp.State = adStateOpen Then rsTemp.Close
rsTemp.Open strQuery, conAudioLib, adOpenKeyset,

CNC © Aasiya Amin 26 DOEACC A-Levels Project


adLockPessimistic, adCmdText
If rsTemp.RecordCount <= 0 Then
MsgBox "You are not Authorized to Add new Users",
vbInformation, "Message..."
Exit Sub
Else
rsTemp.Close
frmAddUser.Show
End If
End If
End Sub

Private Sub mnuFileExit_Click()


End
End Sub

Private Sub mnuFileLogin_Click()


If Not blnLogin Then
frmLogin.Show
Else
MsgBox "You are already Logged in", vbOKOnly +
vbInformation, "Login failed..."
End If
End Sub

Private Sub mnuHelpAbout_Click()


frmAbout.Show vbModal, ALMain
End Sub

Private Sub mnuHelpContents_Click()


cdlgALHelp.ShowHelp
End Sub

Private Sub tbrAL_ButtonClick(ByVal Button As MSComctlLib.Button)


On Error GoTo errHandler
Dim strKey As String
strKey = Button.Key
Select Case strKey
Case "keyAlbumEntry": mnuAlbumEntry_Click

CNC © Aasiya Amin 27 DOEACC A-Levels Project


Case "keyTitleEntry": mnuAlbumTitleEntry_Click
Case "keySongEntry": mnuAlbumSongEntry_Click
Case "keyReports": frmReportCentre.Show
Case "keySongSearch": frmSongSearchReport.Show
Case "keyNavigator": frmMain.Show
Case "keyAddUser": mnuFileAddNewUser_Click
Case "keyExit":
Do While Not Me.ActiveForm Is Nothing
Unload Me.ActiveForm
Loop
End
End Select
Exit Sub
errHandler:
MsgBox "Unable to open"
End Sub

Login Form
This form accepts user name and password and provides option for type of database to use. Only
valid user can move forward from this window. Login Form also provides list of built-in users also
called Application System User such as Admin, Guest and Super user. The other users are
automatically added to the list after first use.

Login Form

Form Properties
Property Value

Name frmLogin

Caption Authentication Check

BorderStyle Fixed

MDIChild True

Controls used in the form


Control for Control Type Properties Values

Database Option 1 OptionButton Name optAccess

CNC © Aasiya Amin 28 DOEACC A-Levels Project


Caption Microsoft Access
Value True

Database Option 2 OptionButton Name optOracle


Caption Oracle SQL

User Name ComboBox Name cmbUserName

Password TextBox Name txtPassword


PasswordChar ‘_’

OK CommandButton Name cmdOK


Caption &OK
Default True

Cancel CommandButton Name cmdCancel


Caption &Cancel
Cancel True

Code
Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()


On Error Resume Next

Dim strQuery As String


Dim rsLogin As New adodb.Recordset
Dim i As Byte

If Me.optOracle.Value = True Then strProvider = "ORACLE"


If txtPassword.Text = "" Or cmbUserName.Text = "" Then
MsgBox "Please provide Username and Password",
vbInformation, "Incomplete info...."
Exit Sub
End If
strQuery = "Select * from Login where Username = "
strQuery = strQuery + "'" + cmbUserName.Text + "' and Password
= '"
strQuery = strQuery + txtPassword.Text + "'"
If rsLogin.State = adStateOpen Then rsLogin.Close
rsLogin.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic, adCmdText

CNC © Aasiya Amin 29 DOEACC A-Levels Project


If rsLogin.RecordCount <= 0 Then
MsgBox "You are not authorised to use this application!",
vbCritical, "Alert!!!"
Exit Sub
Else
blnLogin = True
ALMain.mnuFileLogin.Enabled = False
ALMain.mnuAlbum.Enabled = True
ALMain.mnuFileAddNewUser.Enabled = True
If Me.optAccess.Value = True Then
strProvider = "ACCESS"
Else
strProvider = "ORACLE"
End If
For i = 1 To 11
ALMain.tbrAL.Buttons(i).Enabled = True
Next i
Unload Me
frmMain.Show
End If
End Sub

Private Sub Form_Activate()


On Error GoTo errHandler
Dim rsTemp As New adodb.Recordset
rsTemp.Open "Select Username from Login", conAudioLib,
adOpenStatic, adLockReadOnly, adCmdText
cmbUserName.Clear
If Not (rsTemp.EOF Or rsTemp.BOF) Then
Do While Not rsTemp.EOF
cmbUserName.AddItem rsTemp!Username & ""
rsTemp.MoveNext
Loop
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

CNC © Aasiya Amin 30 DOEACC A-Levels Project


Private Sub Form_Load()
On Error Resume Next

Me.Left = (ALMain.ScaleWidth - Me.Width) / 2


Me.Top = (ALMain.ScaleHeight - Me.Height) / 2

strProvider = "ACCESS"
Me.optAccess.Value = True
Me.optOracle.Value = False

End Sub

Private Sub optAccess_Click()


strProvider = "ACCESS"
End Sub

Private Sub optOracle_Click()


MsgBox "This facility is available in ALMSNet version" & vbCrLf
& "You can't use this option in the current version", _
vbOKOnly + vbInformation, "Not provided"
'strProvider = "ORACLE"
optAccess.Value = True
End Sub

Main Navigation Form


This form provides Iconic Buttons to access different section of Application, such as, Data Entry,
Song Search, Report Generation.

Main Navigation Form

CNC © Aasiya Amin 31 DOEACC A-Levels Project


Form Properties
Property Value

Name frmMain

Caption Navigator

BorderStyle Fixed Single

MDIChild True

KeyPreview True

Controls used in the form


Control for Control Type Properties Values

Data Entry Label Name lblDataEntry


Caption &Data Entry
Image Name imgMain1

Song Search Label Name lblSongSearch


Caption &Song Search
Image Name imgMain2

Report Label Name lblReport


Caption &Report
Image Name imgMain3

Exit Label Name lblExit


Caption E&xit
Image Name imgMain4

Image Mouse Up Image Picture “Mouse Up Picture”

Image Mouse Down Image Picture “Mouse Down Picture”

Code
Dim intLeft As Integer
Dim intDiff As Integer
Dim blnForward As Boolean
Dim blnReverse As Boolean
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "D", "d"
imgMain1_Click
Case "S", "s"
imgMain2_Click
Case "R", "r"

CNC © Aasiya Amin 32 DOEACC A-Levels Project


imgMain3_Click
Case "X", "x"
imgMain4_Click
End Select
If KeyAscii = vbKeyEscape Then Unload Me
End Sub

Private Sub Form_Load()


blnForward = True
blnReverse = False
Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle1.Left = (Me.ScaleWidth - lblTitle1.Width) / 2
lblTitle2.Left = (Me.ScaleWidth - lblTitle2.Width) / 2
Shape1.Left = (Me.ScaleWidth - Shape1.Width) / 2
Shape2.Left = (Me.ScaleWidth - Shape2.Width) / 2
lblByArshad.Left = Shape2.Left
intDiff = Shape2.Width - Shape1.Width
intLeft = Shape2.Left
imgMain1.Picture = imgUp.Picture
imgMain2.Picture = imgUp.Picture
imgMain3.Picture = imgUp.Picture
imgMain4.Picture = imgUp.Picture
End Sub
'This form's DATA ENTRY button
'/////////////////////////////
Private Sub imgMain1_Click()
Load frmAlbumNavigator
frmAlbumNavigator.Show
Unload Me
End Sub
Private Sub imgMain1_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
imgMain1.Picture = imgDn.Picture
End Sub

Private Sub imgMain1_MouseUp(Button As Integer, Shift As Integer,


X As Single, Y As Single)
imgMain1.Picture = imgUp.Picture
End Sub

CNC © Aasiya Amin 33 DOEACC A-Levels Project


'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'This form's SONG SEARCH button
'///////////////////////////////
Private Sub imgMain2_Click()
Load frmSongSearchFL
frmSongSearchFL.Show vbModal, ALMain
End Sub
Private Sub imgMain2_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
imgMain2.Picture = imgDn.Picture
End Sub
Private Sub imgMain2_MouseUp(Button As Integer, Shift As Integer,
X As Single, Y As Single)
imgMain2.Picture = imgUp.Picture
End Sub
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'This form's REPORT button
'///////////////////////////////
Private Sub imgMain3_Click()
On Error GoTo errHandler
Load frmReportCentre
frmReportCentre.Show
Unload Me
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub
Private Sub imgMain3_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
imgMain3.Picture = imgDn.Picture
End Sub
Private Sub imgMain3_MouseUp(Button As Integer, Shift As Integer,
X As Single, Y As Single)
imgMain3.Picture = imgUp.Picture
End Sub
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'This form's EXIT button
'////////////////////////////////
Private Sub imgMain4_Click()
Do While Not ALMain.ActiveForm Is Nothing
Unload ALMain.ActiveForm

CNC © Aasiya Amin 34 DOEACC A-Levels Project


Loop
End
End Sub

Private Sub imgMain4_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgMain4.Picture = imgDn.Picture
End Sub
Private Sub imgMain4_MouseUp(Button As Integer, Shift As Integer,
X As Single, Y As Single)
imgMain4.Picture = imgUp.Picture
End Sub
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Private Sub tmrAnimate_Timer()
If blnForward Then
Shape2.Left = Shape2.Left + 50
lblByArshad.Left = lblByArshad.Left + 50
Else
Shape2.Left = Shape2.Left - 50
lblByArshad.Left = lblByArshad.Left - 50
End If
If Shape2.Left > Shape1.Left + intDiff + 500 Then
blnForward = False
blnReverse = True
End If
If Shape2.Left < intLeft - intDiff - 500 Then
blnForward = True
blnReverse = False
End If
End Sub
Album Navigation Form
This form provides Iconic Buttons to access different Album Data Entry forms to enter data. Data
gets validated before saving in the database. Data Entry to Two-Column Tables is provided by
ellipses (…) with respective fields.

CNC © Aasiya Amin 35 DOEACC A-Levels Project


Album Navigation Form

Form Properties
Property Value

Name frmAlbumNavigator

Caption Album Navigator

BorderStyle Fixed Single

MDIChild True

KeyPreview True

Controls used in the form


Control for Control Type Properties Values

Album Entry CommandButton Name cmdAlbumEntry


Label Caption &Album Entry

Title Entry CommandButton Name cmdTitleEntry


Label Caption &Title Entry

Song Entry CommandButton Name cmdSongEntry


Label Caption &Song Entry

To Navigator CommandButton Name cmdNavigator


Label Caption To &Navigator

Code
Private Sub cmdAlbumEntry_Click()
On Error GoTo errHandler
Load frmAlbum
frmAlbum.Show

CNC © Aasiya Amin 36 DOEACC A-Levels Project


Unload Me
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdNavigator_Click()


On Error GoTo errHandler
Load frmMain
frmMain.Show
Unload Me
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdSongEntry_Click()


On Error GoTo errHandler
Load frmSongEntry
frmSongEntry.Show
Unload Me
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdTitleEntry_Click()


On Error GoTo errHandler
Load frmTitleEntry
frmTitleEntry.Show
Unload Me
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)


Select Case Chr(KeyAscii)

CNC © Aasiya Amin 37 DOEACC A-Levels Project


Case "A", "a"
cmdAlbumEntry_Click
Case "T", "t"
cmdTitleEntry_Click
Case "S", "s"
cmdSongEntry_Click
Case "N", "n"
cmdNavigator_Click
End Select
End Sub

Private Sub Form_Load()


Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle1.Left = (Me.ScaleWidth - lblTitle1.Width) / 2
lblTitle2.Left = (Me.ScaleWidth - lblTitle2.Width) / 2
End Sub

Data Entry for Album Form ………………………………………………………………… (1)


This form provides interface to enter data for Album.

Data Entry for Album Form

Form Properties
Property Value

Name frmAlbum

Caption Data Entry for Album

BorderStyle Fixed Single

CNC © Aasiya Amin 38 DOEACC A-Levels Project


MDIChild True

Controls used in the form


Control for Control Type Properties Values

Album Type ComboBox Name cmbAlbumType

Album # Text Box Name txtAlbumNo

Album Code TextBox Name txtAlbumCode

Recording Company ComboBox Name cmbRecCompany


Image Name imgRecCompany

Year of Release DTPicker Name txtYear

Signatory # TextBox Name txtSigNo

Station Code TextBox Name txtStationCode

Code
Dim rsRec As adodb.Recordset
Dim rsAlbum As adodb.Recordset

Private Sub cmdAdd_Click()


On Error GoTo errHandler
cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdEdit.Enabled = False
cmdDelete.Enabled = False
rsAlbum.AddNew
ClearControls
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
Resume Next
End Sub

Private Sub cmdCancel_Click()


On Error Resume Next
cmdCancel.Enabled = False
cmdSave.Enabled = False

CNC © Aasiya Amin 39 DOEACC A-Levels Project


cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
rsAlbum.CancelUpdate
If rsAlbum.RecordCount > 0 Then
Display
End If
End Sub

Private Sub cmdDelete_Click()


'This procedure will delete a record in Album Table
'and all its Related Records in ALbumDetail Table
On Error GoTo errHandler
Dim intAns As Integer
Dim intAlbumID As Integer
Dim intDetailID As Integer
Dim strQuery As String
Dim rsTemp As New adodb.Recordset
intAns = MsgBox("Deleting the Album will delete all Titles and
" + vbCrLf + " Songs under this Album" + vbCrLf _
+ "Do you want to Proceed (Y/N)", vbInformation +
vbYesNo, "Deleting Record...")
If intAns = vbYes Then
ClearControls
intAlbumID = rsAlbum("AlbumID")
strQuery = "Select * from AlbumDetail where AlbumID = "
strQuery = strQuery + CStr(intAlbumID)
rsTemp.Open strQuery, conAudioLib, adOpenKeyset,
adLockPessimistic
'Deleting all related records form AlbumContent Table
If rsTemp.RecordCount > 0 Then
Do While Not rsTemp.EOF
intDetailID = rsTemp("DetailID")
rsTemp.MoveNext
strQuery = "Delete * from AlbumContent where DetailID
= " + CStr(intDetailID)
conAudioLib.Execute strQuery
Loop
End If
'Deleting all related records from AlbumDetail Table

CNC © Aasiya Amin 40 DOEACC A-Levels Project


strQuery = "Delete * from AlbumDetail where AlbumID = " +
CStr(intAlbumID)
conAudioLib.Execute strQuery
strQuery = "Delete from Album where AlbumID = " +
CStr(intAlbumID)
'Deleting current record from Album Table
conAudioLib.Execute strQuery
rsAlbum.MoveNext
If rs_album.EOF Then
rsAlbum.MoveLast
Display
Else
Display
End If
End If
If rsTemp.State = adStateOpen Then
rsTemp.Close
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
End Sub

Private Sub cmdEdit_Click()


cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdDelete.Enabled = False
End Sub

Private Sub cmdExit_Click()


Load frmAlbumNavigator
frmAlbumNavigator.Show
Unload Me
End Sub

Private Sub cmdFirst_Click()


On Error GoTo errHandler
rsAlbum.MoveFirst

CNC © Aasiya Amin 41 DOEACC A-Levels Project


Display
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
End Sub

Private Sub cmdLast_Click()


On Error GoTo errHandler
rsAlbum.MoveLast
Display
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
End Sub

Private Sub cmdNext_Click()


On Error GoTo errHandler
rsAlbum.MoveNext
If rsAlbum.EOF Then rsAlbum.MoveLast
Display
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
End Sub

Private Sub cmdPrevious_Click()


On Error GoTo errHandler
rsAlbum.MovePrevious
If rsAlbum.BOF Then rsAlbum.MoveFirst
Display
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
End Sub

Private Sub cmdSave_Click()


On Error GoTo errHandler
cmdSave.Enabled = False

CNC © Aasiya Amin 42 DOEACC A-Levels Project


cmdCancel.Enabled = False
cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
SaveAlbum
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
Resume Next
End Sub

Private Sub Form_Activate()


cmdAdd.SetFocus
End Sub

Private Sub Form_Load()


Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle.Left = (Me.ScaleWidth - lblTitle.Width) / 2
'This procedure will set the intial settings for the ALbum form
'Get the module level function to get the connection to the
database
On Error GoTo errHandler
getConnection
Set rsRec = New adodb.Recordset
Set rsAlbum = New adodb.Recordset
rsRec.Open "RecCompany", conAudioLib, adOpenKeyset,
adLockPessimistic, adCmdTable
rsAlbum.Open "Select * from Album Order by AlbumID",
conAudioLib, adOpenKeyset, adLockPessimistic, adCmdText
If rsAlbum.RecordCount > 0 Then
rsAlbum.MoveFirst
Display
End If
If rsRec.RecordCount > 0 Then
Dim i As Integer
rsRec.MoveFirst
For i = 1 To rsRec.RecordCount
cmbRecCompany.AddItem rsRec!RecCompany

CNC © Aasiya Amin 43 DOEACC A-Levels Project


rsRec.MoveNext
Next i
End If
rsRec.MoveFirst
'Adding Values to the Combo box cmbAlbumType
cmbAlbumType.AddItem "LP"
cmbAlbumType.AddItem "CD"
cmbAlbumType.AddItem "SP"
cmbAlbumType.AddItem "78R"
cmdCancel.Enabled = False
cmdSave.Enabled = False
errHandler:
End Sub

Private Sub Form_Unload(Cancel As Integer)


If rsRec.State = adStateOpen Then
rsRec.Close
End If
If rsAlbum.State = adStateOpen Then
rsAlbum.Close
End If
End Sub

Private Sub imgRecCompany_Click()


cmbRecCompany.Text = addNewData("recCompany", "recCompID")
End Sub

Private Sub Display()


cmbAlbumType.Text = rsAlbum!Type & ""
txtAlbumNo.Text = rsAlbum!AlbumNo & ""
txtAlbumCode.Text = rsAlbum!Code & ""
txtYear.Value = rsAlbum!Year
cmbRecCompany.Text = rsAlbum!RecCompany & ""
txtStationCode.Text = rsAlbum!STNCode & ""
txtSigNo.Text = rsAlbum!SignatoryNo & ""
End Sub

Private Sub SaveAlbum()

CNC © Aasiya Amin 44 DOEACC A-Levels Project


Dim intAlbumID As Integer
Dim rsTemp As New adodb.Recordset
rsTemp.Open "Select AlbumID from Album Order by AlbumID", _
conAudioLib, adOpenKeyset, adLockOptimistic, adCmdText
If rsTemp.RecordCount > 0 Then
rsTemp.MoveLast
intAlbumID = rsTemp!AlbumID + 1
Else
intAlbumID = 1
End If
On Error GoTo errHandler
rsAlbum!AlbumID = intAlbumID
rsAlbum!Type = cmbAlbumType.Text
rsAlbum!AlbumNo = txtAlbumNo.Text
rsAlbum!Code = txtAlbumCode.Text
rsAlbum!Year = txtYear.Value
rsAlbum!RecCompany = cmbRecCompany.Text
rsAlbum!STNCode = txtStationCode.Text
rsAlbum!SignatoryNo = txtSigNo.Text
rsAlbum.Update
Exit Sub
errHandler:
Resume Next
MsgBox Err.Description, vbInformation, "ALert"
rsAlbum.CancelUpdate
End Sub

Private Sub Clear()


txtAlbumNo.Text = ""
cmbAlbumType.Text = ""
cmbRecCompany.Text = ""
txtYear.Value = Date
txtAlbumCode.Text = ""
txtSigNo.Text = ""
txtStationCode.Text = ""
cmbAlbumType.SetFocus
End Sub

CNC © Aasiya Amin 45 DOEACC A-Levels Project


Private Sub txtAlbumCode_Validate(Cancel As Boolean)
If txtAlbumCode.Text = "" Then
MsgBox "Album Code Required. You can't leave it blank!",
vbInformation, "Incomplete..."
Cancel = True
End If
Cancel = False
End Sub

Title Entry Form…………………………………………………………………………….… (2)


This form provides interface to enter titles.

Title Entry Form

Form Properties
Property Value

Name frmTitleEntry

Caption Enter Titles

BorderStyle Fixed Single

MDIChild True

Controls used in the form


Control for Control Type Properties Values

Album # ComboBox Name cmbAlbumNo

Album Code ComboBox Name cmbAlbumCode

Title ComboBox Name cmbTitle

Producer ComboBox Name cmbProducer

CNC © Aasiya Amin 46 DOEACC A-Levels Project


Image Name imgProducer

Banner ComboBox Name cmbBanner


Image Name imgBanner

Director ComboBox Name cmbDirector


Image Name imgDirector

Year of Production DTPicker Name txtYear

Film Based CheckBox Name chkFilmBased


Caption Film Based

Code
Dim rsAlbum As adodb.Recordset
Dim rsTemp As adodb.Recordset
Dim rsAlbumDetail As adodb.Recordset
Dim intAlbumID As Integer
Dim strStationCode As String

Private Sub cmbAlbumNo_LostFocus()


On Error GoTo errHandler
Dim strQuery As String
Dim rsTemp1 As New adodb.Recordset

cmbAlbumCode.ListIndex = cmbAlbumNo.ListIndex
strQuery = "Select * from Album where Code = "
strQuery = strQuery + "'" + Trim(cmbAlbumCode.Text) + "'"
strQuery = strQuery + " AND AlbumNo = "
strQuery = strQuery + "'" + cmbAlbumNo.Text + "'"
Debug.Print strQuery
rsTemp.Open strQuery, conAudioLib, adOpenStatic,
adLockReadOnly, adCmdText
If Not (rsTemp.EOF And rsTemp.BOF) Then
intAlbumID = rsTemp!AlbumID
strStationCode = rsTemp!STNCode
strQuery = "Select Name from AlbumDetail Where AlbumID = "
strQuery = strQuery + CStr(rsTemp!AlbumID)
rsTemp1.Open strQuery, conAudioLib, adOpenKeyset,
adLockReadOnly, adCmdText
cmbTitle.Clear
Do While Not rsTemp1.EOF

CNC © Aasiya Amin 47 DOEACC A-Levels Project


cmbTitle.AddItem rsTemp1!Name
rsTemp1.MoveNext
Loop
End If
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
If Not rsTemp1.Source = "" Then
rsTemp1.Close
End If
If Not rsAlbumDetail.Source = "" Then
rsAlbumDetail.Close
End If
strQuery = "Select * from AlbumDetail where AlbumID = "
strQuery = strQuery + CStr(intAlbumID)
rsAlbumDetail.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic, adCmdText
If Not (rsAlbumDetail.BOF And rsAlbumDetail.EOF) Then
DisplayRecords
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdAdd_Click()


On Error GoTo errHandler
cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdEdit.Enabled = False
cmdDelete.Enabled = False
rsAlbumDetail.AddNew
ClearControls
cmbTitle.SetFocus
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

CNC © Aasiya Amin 48 DOEACC A-Levels Project


Private Sub cmdCancel_Click()
On Error GoTo errHandler
cmdCancel.Enabled = False
cmdSave.Enabled = False
cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
rsAlbumDetail.CancelUpdate
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdDelete_Click()


On Error GoTo errHandler
Dim intAns As Integer
Dim intDetailID As Integer
Dim strQuery As String

intAns = MsgBox("Deleting the Album Title will delete " _


+ vbCrLf + " all Songs under this Title" _
+ vbCrLf + "Do you want to Proceed (Y/N)", _
vbInformation + vbYesNo, "Deleting Records...")
If intAns = vbYes Then
If rsAlbumDetail.EOF And rsAlbumDetail.BOF Then
MsgBox "There are no Titles under Album No" + _
cmbAlbumNo.Text + vbCrLf + _
"To Add New Titles Click Add Button", _
vbInformation, "Alert..."
Exit Sub
End If
intDetailID = rsAlbumDetail!detailid
strQuery = "Delete * from AlbumContent where DetailID = "
strQuery = strQuery + CStr(intDetailID)
conAudioLib.Execute strQuery
strQuery = "Delete * from AlbumDetail where DetailID = "
strQuery = strQuery + CStr(intDetailID)

CNC © Aasiya Amin 49 DOEACC A-Levels Project


conAudioLib.Execute strQuery
rsAlbumDetail.MoveNext
If rsAlbumDetail.EOF Then
If rsAlbumDetail.BOF Then
MsgBox "There are no Titles under Album No" + _
cmbalbum.Text + vbCrLf + _
"To Add New Titles Click Add Button", _
vbInformation, "Alert..."
End If
rsAlbumDetail.MovePrevious
DisplayRecords
Exit Sub
End If
DisplayRecords
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation, "Error..."
ClearControls
cmbTitle.SetFocus
End Sub

Private Sub cmdEdit_Click()


On Error GoTo errHandler
cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdDelete.Enabled = False
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdExit_Click()


On Error GoTo errHandler
Load frmAlbumNavigator
frmAlbumNavigator.Show
Unload Me

CNC © Aasiya Amin 50 DOEACC A-Levels Project


Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdFirst_Click()


On Error GoTo errHandler
If Not (rsAlbumDetail.BOF And rsAlbumDetail.EOF) Then
rsAlbumDetail.MoveFirst
DisplayRecords
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdLast_Click()


On Error GoTo errHandler
If Not (rsAlbumDetail.BOF And rsAlbumDetail.EOF) Then
rsAlbumDetail.MoveLast
DisplayRecords
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdNext_Click()


On Error GoTo errHandler
If Not (rsAlbumDetail.BOF And rsAlbumDetail.EOF) Then
rsAlbumDetail.MoveNext
If rsAlbumDetail.EOF Then
rsAlbumDetail.MoveLast
Exit Sub
End If
DisplayRecords
End If
Exit Sub

CNC © Aasiya Amin 51 DOEACC A-Levels Project


errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdPrevious_Click()


On Error GoTo errHandler
If Not (rsAlbumDetail.BOF And rsAlbumDetail.EOF) Then
rsAlbumDetail.MovePrevious
If rsAlbumDetail.BOF Then
rsAlbumDetail.MoveFirst
Exit Sub
End If
DisplayRecords
End If
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdSave_Click()


On Error GoTo errHandler
cmdSave.Enabled = False
cmdCancel.Enabled = False
cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
SaveTitle
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub Form_Load()


Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitleHead.Left = (Me.ScaleWidth - lblTitleHead.Width) / 2

CNC © Aasiya Amin 52 DOEACC A-Levels Project


On Error Resume Next
cmdCancel.Enabled = False
cmdSave.Enabled = False

'Connecting to DataBase
getConnection

Set rsAlbum = New adodb.Recordset


Set rsTemp = New adodb.Recordset
Set rsAlbumDetail = New adodb.Recordset
rsAlbum.Open "Album", conAudioLib, adOpenKeyset, adLockReadOnly
If Not (rsAlbum.EOF And rsAlbum.BOF) Then
rsAlbum.MoveFirst
Do While Not rsAlbum.EOF
cmbAlbumNo.AddItem rsAlbum!AlbumNo
cmbAlbumCode.AddItem rsAlbum!Code
rsAlbum.MoveNext
Loop
rsAlbum.MoveFirst
cmbAlbumNo.Text = rsAlbum!AlbumNo & ""
cmbAlbumCode.Text = rsAlbum!Code & ""
End If
'Filling Producer combo box
rsTemp.Open "Producer", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbProducer.AddItem rsTemp!Producer & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If
'Filling Banner combo box
rsTemp.Open "Banner", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then

CNC © Aasiya Amin 53 DOEACC A-Levels Project


rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbBanner.AddItem rsTemp!Banner & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If
'Filling Director combo box
rsTemp.Open "Director", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbDirector.AddItem rsTemp!Director & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If
DisplayRecords
End Sub

Private Sub imgBanner_Click()


On Error GoTo errHandler
cmbBanner.Text = addNewData("Banner", "BannerID")
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub imgDirector_Click()


On Error GoTo errHandler
cmbDirector.Text = addNewData("Director", "DirectorID")
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."

CNC © Aasiya Amin 54 DOEACC A-Levels Project


End Sub

Private Sub imgProducer_Click()


On Error GoTo errHandler
cmbProducer.Text = addNewData("Producer", "ProducerID")
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub ClearControls()


On Error GoTo errHandler
cmbTitle.Text = ""
cmbProducer.Text = ""
cmbBanner.Text = ""
cmbDirector.Text = ""
txtYear.Value = Date
chkFilmBased.Value = 0
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Public Sub SaveTitle()


On Error GoTo errHandler
Dim intDetailID As Integer
Dim rsTemp As New adodb.Recordset

rsTemp.Open "Select DetailID from AlbumDetail Order by


DetailID", _
conAudioLib, adOpenKeyset, adLockOptimistic, adCmdText
If rsTemp.RecordCount > 0 Then
rsTemp.MoveLast
intDetailID = rsTemp!detailid + 1
Else
intDetailID = 1
End If
If rsTemp.State = adStateOpen Then

CNC © Aasiya Amin 55 DOEACC A-Levels Project


rsTemp.Close
End If
rsAlbumDetail!detailid = intDetailID
rsAlbumDetail!Banner = cmbBanner.Text
rsAlbumDetail!Director = cmbDirector.Text
rsAlbumDetail!Producer = cmbProducer.Text
rsAlbumDetail!AlbumID = intAlbumID
rsAlbumDetail!FilmBased = chkFilmBased.Value
rsAlbumDetail!Name = Trim(cmbTitle.Text)
rsAlbumDetail!ProductYear = txtYear.Value
rsAlbumDetail.Update
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub DisplayRecords()


On Error GoTo errHandler
cmbBanner.Text = rsAlbumDetail!Banner & ""
cmbProducer.Text = rsAlbumDetail!Producer & ""
cmbDirector.Text = rsAlbumDetail!Director & ""
chkFilmBased.Value = rsAlbumDetail!FilmBased
cmbTitle.Text = rsAlbumDetail!Name
txtYear.Value = rsAlbumDetail!ProductYear
Exit Sub
errHandler:
ClearControls
cmbTitle.SetFocus
End Sub

Private Sub tmrTitle_Timer()


On Error GoTo errHandler
Dim strMsg As String
strMsg = "Enter Album Titles For Album Number :" &
cmbAlbumNo.Text
ALMain.stbAL.Panels(1).Text = strMsg & ", Album Code : " &
cmbAlbumCode.Text
Exit Sub
errHandler:

CNC © Aasiya Amin 56 DOEACC A-Levels Project


MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub

Song Entry Form…………………………………………………………………………….… (3)


This form provides interface to enter songs for tiles / films.

Song Entry Form

Form Properties
Property Value

Name frmSongEntry

Caption Songs for Titles/Films

BorderStyle Fixed Single

MDIChild True

Controls used in the form


Control for Control Type Properties Values

Album Title ComboBox Name cmbAlbumTitle

Song ComboBox Name cmbSong

Category ComboBox Name cmbCategory


Image Name imgCategory

Language ComboBox Name cmbLanguage


Image Name imgLanguage

Lyricist ComboBox Name cmbLyricist


Image Name imgLyricist

Music Director ComboBox Name cmbMusicDir

CNC © Aasiya Amin 57 DOEACC A-Levels Project


Control for Control Type Properties Values

Image Name imgMusicDir

Raga ComboBox Name cmbRaga


Image Name imgRaga

Artist1, 2 and 3 ComboBox Name cmbArtist1, 2, and 3


Image Name imgArtist1, 2 and 3

Song Type ComboBox Name cmbSongType

Remarks TextBox Name txtRemarks


MultiLine True
Scrollbar Vertical

Duration UpDown Name udDuration


BuddyControl txtDuration
BuddyProperty Text
TextBox Name txtDuration

Side TextBox Name txtSide

Cut UpDown Name udCut


BuddyControl txtCut
BuddyProperty Text
TextBox Name txtCut

Code
Dim intDetailID As Integer
Dim strStationCode As String
Dim rsSong As adodb.Recordset
Dim rsTempSong As adodb.Recordset

Private Sub cmbAlbumTitle_LostFocus()


On Error GoTo errHandler
Dim rsTemp As New adodb.Recordset
Dim strQuery As String

strQuery = "Select * from AlbumDetail where Name = "


strQuery = strQuery + "'" + cmbAlbumTitle.Text + "'"
rsTemp.Open strQuery, conAudioLib, adOpenStatic,
adLockReadOnly, adCmdText
If Not (rsTemp.EOF And rsTemp.BOF) Then
intDetailID = rsTemp!detailid
strQuery = "Select * from AlbumContent where DetailID = "

CNC © Aasiya Amin 58 DOEACC A-Levels Project


strQuery = strQuery + CStr(intDetailID)
If Not rsSong.Source = "" Then
rsSong.Close
End If
rsSong.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic, adCmdText
cmbSong.Clear
If Not (rsSong.EOF And rsSong.BOF) Then
Do While Not rsSong.EOF
cmbSong.AddItem rsSong!FirstLine
rsSong.MoveNext
Loop
rsSong.MoveFirst
DisplaySong
End If
End If
Exit Sub
errHandler:
End Sub

Private Sub cmbSongType_LostFocus()


On Error GoTo errHandler
Dim strSongType As String
Dim i As Integer

'Finding if the value is present in Song type table, if


'the value is not there then insert it in recCompany table
strSongType = Trim(cmbSongType.Text)
For i = 0 To cmbSongType.ListCount - 1
If strSongType = cmbSongType.List(i) Then
Exit Sub
End If
Next i
conAudioLib.Execute "Insert into SongType(SongType) values ('"
+ cmbSongType.Text + "')"
Exit Sub
errHandler:
End Sub

CNC © Aasiya Amin 59 DOEACC A-Levels Project


Private Sub cmdAdd_Click()
On Error GoTo errHandler
cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdEdit.Enabled = False
cmdDelete.Enabled = False
ClearControls
rsTempSong.AddNew
cmbSong.SetFocus
Exit Sub
errHandler:
End Sub

Private Sub cmdCancel_Click()


On Error GoTo errHandler
cmdCancel.Enabled = False
cmdSave.Enabled = False
cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
rsSong.CancelUpdate
Exit Sub
errHandler:
End Sub

Private Sub cmdDelete_Click()


On Error GoTo errHandler
If Not (rsSong.EOF And rsSong.BOF) Then
rsSong.Delete
rsSong.MoveNext
If Not rsSong.EOF Then
DisplaySong
Exit Sub
Else
rsSong.MovePrevious
DisplaySong
Exit Sub

CNC © Aasiya Amin 60 DOEACC A-Levels Project


End If
Else
ClearControls
End If
ClearControls
Exit Sub
errHandler:
End Sub

Private Sub cmdEdit_Click()


cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdDelete.Enabled = False
End Sub

Private Sub cmdExit_Click()


On Error GoTo errHandler
Load frmAlbumNavigator
frmAlbumNavigator.Show
Unload Me
Exit Sub
errHandler:
End Sub

Private Sub cmdFirst_Click()


On Error GoTo errHandler
If Not (rsSong.BOF And rsSong.EOF) Then
rsSong.MoveFirst
DisplaySong
End If
errHandler:
End Sub

Private Sub cmdLast_Click()


On Error GoTo errHandler
If Not (rsSong.BOF And rsSong.EOF) Then
rsSong.MoveLast

CNC © Aasiya Amin 61 DOEACC A-Levels Project


DisplaySong
End If
Exit Sub
errHandler:
End Sub

Private Sub cmdNext_Click()


On Error GoTo errHandler
If Not (rsSong.BOF And rsSong.EOF) Then
rsSong.MoveNext
If rsSong.EOF Then
rsSong.MoveLast
Exit Sub
End If
DisplaySong
End If
Exit Sub
errHandler:
End Sub

Private Sub cmdPrevious_Click()


On Error GoTo errHandler
If Not (rsSong.BOF And rsSong.EOF) Then
rsSong.MovePrevious
If rsSong.BOF Then
rsSong.MoveFirst
Exit Sub
End If
DisplaySong
End If
Exit Sub
errHandler:
End Sub

Private Sub cmdSave_Click()


On Error GoTo errHandler
cmdSave.Enabled = False
cmdCancel.Enabled = False

CNC © Aasiya Amin 62 DOEACC A-Levels Project


cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
SaveSong
Exit Sub
errHandler:
End Sub

Private Sub Form_Activate()


On Error GoTo errHandler
ClearControls
cmbAlbumTitle.SetFocus
Exit Sub
errHandler:
End Sub

Private Sub Form_Load()


Dim rsTemp As New adodb.Recordset
Dim rsTempSongType As New adodb.Recordset

Me.Left = (ALMain.ScaleWidth - Me.Width) / 2


Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle.Left = (Me.ScaleWidth - lblTitle.Width) / 2

On Error GoTo errHandler


Set rsSong = New adodb.Recordset
Set rsTempSong = New adodb.Recordset
getConnection
cmdSave.Enabled = False
cmdCancel.Enabled = False
rsTempSong.Open "AlbumContent", conAudioLib, adOpenKeyset,
adLockPessimistic, adCmdTable
rsTemp.Open "Select Name from AlbumDetail", conAudioLib,
adOpenStatic, adLockReadOnly
If rsTemp.EOF And rsTemp.BOF Then
MsgBox "There are no Titles." & vbCrLf & "Go to Title Entry
First", vbCritical, "Alert..."
Unload Me
Exit Sub

CNC © Aasiya Amin 63 DOEACC A-Levels Project


End If
DoEvents
Do While Not rsTemp.EOF
cmbAlbumTitle.AddItem rsTemp!Name
rsTemp.MoveNext
Loop
cmbAlbumTitle.ListIndex = 0
If Not rsTemp.Source = "" Then
rsTemp.Close
End If

'Displaying records in SongType comboBox


rsTempSongType.Open "Select * from SongType", conAudioLib,
adOpenKeyset, adLockOptimistic
Do While Not rsTempSongType.EOF
cmbSongType.AddItem rsTempSongType!SongType & ""
rsTempSongType.MoveNext
Loop

'Displaying records in Category combo box


rsTemp.Open "Category", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
DoEvents
Do While Not rsTemp.EOF
cmbCategory.AddItem rsTemp!Category & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If

'Filling Music Director combo box


rsTemp.Open "MusicDir", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst

CNC © Aasiya Amin 64 DOEACC A-Levels Project


DoEvents
Do While Not rsTemp.EOF
cmbMusicDir.AddItem rsTemp!MusicDir & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If

'Filling Raga combo box


rsTemp.Open "Raga", conAudioLib, adOpenStatic, adLockReadOnly,
adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbRaga.AddItem rsTemp!RagaDetails & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If

'Filling Artist1,2,3 combo boxes


rsTemp.Open "Artist", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbArtist1.AddItem rsTemp!ArtistName & ""
cmbArtist2.AddItem rsTemp!ArtistName & ""
cmbArtist3.AddItem rsTemp!ArtistName & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If

CNC © Aasiya Amin 65 DOEACC A-Levels Project


'Filling Lyrics combo box
rsTemp.Open "Lyrics", conAudioLib, adOpenStatic,
adLockReadOnly, adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbLyricist.AddItem rsTemp!Lyrics & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If

'Filling Language combo box


rsTemp.Open "Lang", conAudioLib, adOpenStatic, adLockReadOnly,
adCmdTable
If Not (rsTemp.EOF And rsTemp.BOF) Then
rsTemp.MoveFirst
Do While Not rsTemp.EOF
cmbLanguage.AddItem rsTemp!Language & ""
rsTemp.MoveNext
Loop
If Not rsTemp.Source = "" Then
rsTemp.Close
End If
End If
Exit Sub
errHandler:
MsgBox "Connection Error: " & Err.Description, , "Error..."
End Sub

Private Sub Form_Unload(Cancel As Integer)


On Error GoTo errHandler
If Not rsTempSong.Source = "" Then
rsTempSong.Close
End If
Exit Sub

CNC © Aasiya Amin 66 DOEACC A-Levels Project


errHandler:
End Sub

Private Sub imgArtist1_Click()


cmbArtist1.Text = addNewData("Artist", "ArtistID")
End Sub

Private Sub imgArtist2_Click()


cmbArtist2.Text = addNewData("Artist", "ArtistID")
End Sub

Private Sub imgArtist3_Click()


cmbArtist3.Text = addNewData("Artist", "ArtistID")
End Sub

Private Sub imgCategory_Click()


cmbCategory.Text = addNewData("Category", "CategoryID")
End Sub

Private Sub imgLanguage_Click()


cmbLanguage.Text = addNewData("Lang", "LanguageID")
End Sub

Private Sub imgLyricist_Click()


cmbLyricist.Text = addNewData("Lyrics", "LyricsID")
End Sub

Private Sub imgMusicDir_Click()


cmbMusicDir.Text = addNewData("MusicDir", "MusicDirID")
End Sub

Private Sub imgRaga_Click()


cmbRaga.Text = addNewData("Raga", "RagaID")
End Sub

Private Sub ClearControls()


On Error Resume Next
cmbSong.Text = ""

CNC © Aasiya Amin 67 DOEACC A-Levels Project


cmbCategory.Text = ""
cmbLanguage.Text = ""
cmbLyricist.Text = ""
cmbRaga.Text = ""
cmbArtist1.Text = ""
cmbArtist2.Text = ""
cmbArtist3.Text = ""
cmbMusicDir.Text = ""
txtRemarks.Text = ""
udDuration.Value = 0
txtSide.Text = ""
udCut.Value = 0
cmbSongType.Text = ""
End Sub

Private Sub SaveSong()


On Error GoTo errHandler
Dim intSongID As Integer
Dim rsTemp As New adodb.Recordset

rsTemp.Open "Select SongID from AlbumContent Order by SongID",


conAudioLib, adOpenKeyset, adLockOptimistic, adCmdText
If rsTemp.RecordCount > 0 Then
rsTemp.MoveLast
intSongID = rsTemp!SongID + 1
Else
intSongID = 1
End If
If rsTemp.State = adStateOpen Then
rsTemp.Close
End If

rsTempSong!SongID = intSongID
rsTempSong!detailid = intDetailID
rsTempSong!FirstLine = cmbSong.Text
If Not txtDuration.Text = "" Then
rsTempSong!Duration = CInt(txtDuration.Text)
End If

CNC © Aasiya Amin 68 DOEACC A-Levels Project


If Not txtCut.Text = "" Then
rsTempSong!Cut = CInt(txtCut.Text)
End If
rsTempSong!Side = Trim(txtSide.Text)
rsTempSong!Remarks = Trim(txtRemarks.Text)
rsTempSong!Category = Trim(cmbCategory.Text)
rsTempSong!Raga = Trim(cmbRaga.Text)
rsTempSong!Language = Trim(cmbLanguage.Text)
rsTempSong!Artist1 = Trim(cmbArtist1.Text)
rsTempSong!Artist2 = Trim(cmbArtist2.Text)
rsTempSong!Artist3 = Trim(cmbArtist3.Text)
rsTempSong!Lyrics = Trim(cmbLyricist.Text)
rsTempSong!MusicDir = Trim(cmbMusicDir.Text)
rsTempSong!SongType = Trim(cmbSongType.Text)
rsTempSong.Update
Exit Sub
errHandler:
MsgBox Err.Description, , "Error..."
End Sub

Private Sub txtCut_Validate(Cancel As Boolean)


On Error GoTo errHandler
If Not IsNumeric(txtCut.Text) Then
MsgBox "Please Enter only numeric values", vbInformation,
"Alert..."
udCut.Value = 0
Cancel = True
Else
Cancel = False
End If
Exit Sub
errHandler:
End Sub

Private Sub txtDuration_Validate(Cancel As Boolean)


If Not IsNumeric(txtDuration.Text) Then
MsgBox "Please Enter only numeric values", vbInformation,
"Alert..."
udDuration.Value = 0

CNC © Aasiya Amin 69 DOEACC A-Levels Project


Cancel = True
Else
Cancel = False
End If
End Sub

Public Sub DisplaySong()


On Error GoTo errHandler
If Not (rsSong.BOF And rsSong.BOF) Then
cmbSong.Text = rsSong!FirstLine & ""
cmbCategory.Text = rsSong!Category & ""
cmbLanguage.Text = rsSong!Language & ""
cmbLyricist.Text = rsSong!Lyrics & ""
cmbRaga.Text = rsSong!Raga & ""
cmbArtist1.Text = rsSong!Artist1 & ""
cmbArtist2.Text = rsSong!Artist2 & ""
cmbArtist3.Text = rsSong!Artist3 & ""
cmbMusicDir.Text = rsSong!MusicDir & ""
txtRemarks.Text = rsSong!Remark & ""
txtDuration.Text = rsSong!Duration
txtSide.Text = rsSong!Side & ""
txtCut.Text = rsSong!Cut
cmbSongType.Text = rsSong!SongType & ""
Else
ClearControls
End If
Exit Sub
errHandler:
txtDuration.Text = ""
Resume Next
End Sub

Common Controls used in the form (1) to (3) above

Control for Control Type Properties Values

First Record CommandButton Name cmdFirst

Previous Record CommandButton Name cmdPrevious

CNC © Aasiya Amin 70 DOEACC A-Levels Project


Control for Control Type Properties Values

Next Record CommandButton Name cmdNext

Last Record CommandButton Name cmdLast

Add New Record CommandButton Name cmdAdd

Delete Current Record CommandButton Name cmdDelete

Edit Current Record CommandButton Name cmdEdit

Save Current Record CommandButton Name cmdSave

Cancel Last Changes CommandButton Name cmdCancel

To Exit CommandButton Name cmdExit


Cancel True

Song Search By First Line Form


This form is displayed when Song Search option in Main Navigator Form is selected by clicking.
First Line of the song to search can be typed or selected from the list.

Song Search By First Line Form

Form Properties
Property Value

Name frmSongSearchFL

Caption Song Search by First Line

BorderStyle Fixed Single

CNC © Aasiya Amin 71 DOEACC A-Levels Project


Controls used in the form
Control for Control Type Properties Values

First Line of Song ComboBox Name cmbFirstLine

OK CommandButton Name cmdOK


Default True

Cancel CommandButton Name cmdCancel


Cancel True

Code
Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()


On Error GoTo errHandler

Dim strQuery As String


Dim strFirstLine As String

strFirstLine = cmbFirstLine.Text
If strFirstLine = "" Then
Exit Sub
End If
strQuery = "Select Code, Name, Firstline, Artist1, Artist2 from
"
strQuery = strQuery & " Album, AlbumDetail, AlbumContent "
strQuery = strQuery & " where Album.AlbumID =
AlbumDetail.AlbumID "
strQuery = strQuery & " And AlbumDetail.DetailID =
AlbumContent.DetailID "
strQuery = strQuery & " And AlbumContent.Firstline in "
strQuery = strQuery & " (Select Distinct AlbumContent.FirstLine
from AlbumContent "
strQuery = strQuery & " Where FirstLine Like '" & strFirstLine
& "%')"
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptSongSearch.DataSource = rsSongSearch
If rsSongSearch.RecordCount <= 0 Then
GoTo errHandler

CNC © Aasiya Amin 72 DOEACC A-Levels Project


End If
Unload Me
rptSongSearch.Show
Exit Sub
errHandler:
MsgBox "No Songs Matched!", vbInformation + vbOKOnly, "Nothing
there..."
rsSongSearch.Close
End Sub

Private Sub Form_Load()


On Error GoTo errHandler

Dim rsTemp As New adodb.Recordset

Me.Left = (ALMain.ActiveForm.Width - Me.Width) / 2 +


ALMain.ActiveForm.Left
Me.Top = (ALMain.ActiveForm.Top + ALMain.ActiveForm.Height)

getConnection
Set rsSongSearch = New adodb.Recordset
rsTemp.Open "Select FirstLine from AlbumContent", conAudioLib,
adOpenKeyset, adLockOptimistic
Do While Not rsTemp.EOF
cmbFirstLine.AddItem rsTemp!FirstLine
rsTemp.MoveNext
Loop
rsTemp.Close
Exit Sub
errHandler:
MsgBox Err.Description, vbOKOnly + vbInformation, "Error..."
End Sub
Report Centre Form
This form provides option to generate Reports for print outs in different six ways.

CNC © Aasiya Amin 73 DOEACC A-Levels Project


Report Centre Form

Form Properties
Property Value

Name frmReportCentre

Caption Reporting Centre

BorderStyle Fixed Single

MDIChild True

Controls used in the form


Control for Control Type Properties Values

Year-wise Report CommandButton Name cmdYearWise

Selected Lyricist Report CommandButton Name cmdSelLyricist

Film-wise Report CommandButton Name cmdFileWise

Selected Composer Report CommandButton Name cmdSelComposer

Selected Singer Report CommandButton Name cmdSelSinger

Choice Songs Report CommandButton Name cmdChoice

To Navigator CommandButton Name cmdNavigator

Code
Private Sub cmdChoice_Click()
frmSongSearchReport.Show
Unload Me

CNC © Aasiya Amin 74 DOEACC A-Levels Project


End Sub

Private Sub cmdFilmWise_Click()


On Error GoTo errHandler
Dim strQuery As String
Dim strFilmName As String
Dim lblFilmName1 As RptLabel
Dim lblFilmName2 As RptLabel

strReportCaption = "Films"
Set rsSongSearch = New adodb.Recordset
strFilmName = showDialog("Enter Film Name", "AlbumDetail",
"Name")
If strFilmName = "" Then
Exit Sub
Else
strQuery = "Select Album.Code, AlbumDetail.Name,
AlbumContent.FirstLine, "
strQuery = strQuery & "AlbumContent.Artist1,
AlbumContent.Artist2 From "
strQuery = strQuery & "(Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN AlbumContent On
AlbumDetail.DetailID = AlbumContent.DetailID "
strQuery = strQuery & "Where AlbumDetail.Name = '" &
strFilmName & "'"
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptFilmWise.DataSource = rsSongSearch
Set lblFilmName1 = rptFilmWise.Sections(2).Controls(1)
lblFilmName1.Caption = "Film Name : "
Set lblFilmName2 = rptFilmWise.Sections(2).Controls(2)
lblFilmName2.Caption = strFilmName
rptFilmWise.Show
End If
Exit Sub
errHandler:
MsgBox Err.Description & vbCrLf & "No Songs Matched", vbOKOnly
+ vbInformation, "Error..."
End Sub

CNC © Aasiya Amin 75 DOEACC A-Levels Project


Private Sub cmdNavigator_Click()
Load frmMain
frmMain.Show
Unload Me
End Sub

Private Sub cmdSelComposer_Click()


On Error GoTo errHandler
Dim strQuery As String
Dim strComposerName As String
Dim lblComposerName1 As RptLabel
Dim lblComposerName2 As RptLabel

strReportCaption = "Composers"
Set rsSongSearch = New adodb.Recordset
strComposerName = showDialog("Select Composer Name",
"MusicDir", "MusicDir")
If strComposerName = "" Then
Exit Sub
Else
strQuery = "Select Album.Code, AlbumDetail.Name,
AlbumContent.MusicDir, "
strQuery = strQuery & "AlbumContent.FirstLine,
AlbumContent.Artist1, "
strQuery = strQuery & "AlbumContent.Artist2 From "
strQuery = strQuery & "(Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN Albumcontent ON
AlbumDetail.DetailID = AlbumContent.DetailID "
strQuery = strQuery & "Where (((AlbumContent.MusicDir)='" &
strComposerName & "'))"
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptSongSearch.DataSource = rsSongSearch
Set lblComposerName1 = rptSongSearch.Sections(2).Controls(6)
lblComposerName1.Caption = "Composer Name : "
Set lblComposerName2 = rptSongSearch.Sections(2).Controls(7)
lblComposerName2.Caption = strComposerName
rptSongSearch.Show
End If
Exit Sub

CNC © Aasiya Amin 76 DOEACC A-Levels Project


errHandler:
MsgBox "No Songs Matched", vbOKOnly + vbInformation, "Error..."
End Sub

Private Sub cmdSelLyricist_Click()


On Error GoTo errHandler
Dim strQuery As String
Dim strLyricName As String
Dim lblLyricName1 As RptLabel
Dim lblLyricName2 As RptLabel

strReportCaption = "Lyricists"
Set rsSongSearch = New adodb.Recordset
strLyricName = showDialog("Select Lyrcist Name", "Lyrics",
"Lyrics")
If strLyricName = "" Then
Exit Sub
Else
strQuery = "Select Album.Code, AlbumDetail.Name,
AlbumContent.Lyrics, "
strQuery = strQuery & "AlbumContent.FirstLine,
AlbumContent.Artist1, AlbumContent.Artist2 "
strQuery = strQuery & "From (Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN AlbumContent ON
AlbumDetail.DetailID = AlbumContent.DetailID "
strQuery = strQuery & "Where AlbumContent.Lyrics = '" &
strLyricName & "'"
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptSongSearch.DataSource = rsSongSearch
Set lblLyricName1 = rptSongSearch.Sections(2).Controls(6)
lblLyricName1.Caption = "Lyricist : "
Set lblLyricName2 = rptSongSearch.Sections(2).Controls(7)
lblLyricName2.Caption = strLyricName
rptSongSearch.Show
End If
Exit Sub
errHandler:
MsgBox "No Songs Matched", vbOKOnly + vbInformation, "Error..."
End Sub

CNC © Aasiya Amin 77 DOEACC A-Levels Project


Private Sub cmdSelSinger_Click()
On Error GoTo errHandler
Dim strQuery As String
Dim strSinger As String
Dim lblSinger1 As RptLabel
Dim lblSinger2 As RptLabel

strReportCaption = "Singers"
Set rsSongSearch = New adodb.Recordset
strSinger = showDialog("Select Singer Name", "Artist",
"ArtistName")
If strSinger = "" Then
Exit Sub
Else
strQuery = "Select Album.Code, AlbumDetail.Name,
AlbumContent.FirstLine, "
strQuery = strQuery & "AlbumContent.Artist1,
AlbumContent.Artist2, AlbumContent.Artist3 "
strQuery = strQuery & "From (Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN AlbumContent ON
AlbumDetail.DetailID = AlbumContent.DetailID "
strQuery = strQuery & "Where (AlbumContent.Artist1 = '" &
strSinger & "') OR "
strQuery = strQuery & "(AlbumContent.Artist2 = '" &
strSinger & "') OR "
strQuery = strQuery & "(AlbumContent.Artist3 = '" &
strSinger & "')"
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptGeneral.DataSource = rsSongSearch
Set lblSinger1 = rptGeneral.Sections(2).Controls(1)
lblSinger1.Caption = "Singer Name : "
Set lblSinger2 = rptGeneral.Sections(2).Controls(2)
lblSinger2.Caption = strSinger
rptGeneral.Show
End If
Exit Sub
errHandler:
MsgBox "No Songs Matched", vbOKOnly + vbInformation, "Error..."

CNC © Aasiya Amin 78 DOEACC A-Levels Project


End Sub

Private Sub cmdYearWise_Click()


On Error GoTo errHandler
Dim strQuery As String
Dim strYear As String
Dim lblYear1 As RptLabel
Dim lblYear2 As RptLabel
Dim strCurYear As String

strReportCaption = "Years"
Set rsSongSearch = New adodb.Recordset
strCurYear = Right(Format(Date, "Long Date"), 4)
Do While True
strYear = InputBox(vbCrLf & "Enter the Year" _
& vbCrLf & vbCrLf & _
"Year should be a 4-digit integer", _
"Year-Wise Report", strCurYear)
If strYear = "" Then
Exit Sub
ElseIf Not IsNumeric(strYear) Then
MsgBox "Wrong value for Year, Enter Year as 4 digit
Integer", , "Wrong Year"
ElseIf Len(strYear) <> 4 Then
MsgBox "Not a valid Year" & vbCrLf & "Enter Year as 4
digit Integer", , "Wrong Year"
Else
Exit Do
End If
Loop

strQuery = "Select Album.Code, AlbumDetail.Name,


AlbumDetail.ProductYear, "
strQuery = strQuery & "AlbumContent.FirstLine,
AlbumContent.Artist1, AlbumContent.Artist2 "
strQuery = strQuery & "From (Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN AlbumContent ON
AlbumDetail.DetailID = AlbumContent.DetailID "
strQuery = strQuery & "Where (AlbumDetail.ProductYear Between "

CNC © Aasiya Amin 79 DOEACC A-Levels Project


If strProvider = "QRACLE" Then
strQuery = strQuery & "'1/1/" & strYear & "' "
strQuery = strQuery & "AND '30/12/" & strYear & "')"
Else
strQuery = strQuery & "#1/1/" & strYear & "# "
strQuery = strQuery & "AND #30/12/" & strYear & "#)"
End If
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptGeneral.DataSource = rsSongSearch
Set lblYear1 = rptGeneral.Sections(2).Controls(1)
lblYear1.Caption = "Song's of Year : "
Set lblYear2 = rptGeneral.Sections(2).Controls(2)
lblYear2.Caption = strYear
rptGeneral.Show
cmdYearWise.SetFocus
Exit Sub
errHandler:
MsgBox "No Songs Matched", vbOKOnly + vbInformation,
"Error..."
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)


Select Case Chr(KeyAscii)
Case "Y", "y"
cmdYearWise_Click
Case "L", "l"
cmdSelLyricist_Click
Case "F", "f"
cmdFilmWise_Click
Case "C", "c"
cmdSelComposer_Click
Case "S", "s"
cmdSelSinger_Click
Case "O", "o"
cmdChoice_Click
Case "N", "n"
cmdNavigator_Click

CNC © Aasiya Amin 80 DOEACC A-Levels Project


End Select
End Sub

Private Sub Form_Load()


Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle1.Left = (Me.ScaleWidth - lblTitle1.Width) / 2
lblTitle2.Left = (Me.ScaleWidth - lblTitle2.Width) / 2
getConnection
End Sub
General Dialog Form
This Dialog Form provides interface to enter search data for retrieving record from database for
further processing at form levels especially for generating Reports. The Caption and Label of the
form gets changed according to context.

General Dialog Form

Form Properties
Property Value

Name frmDialog

Caption <General>

BorderStyle Fixed Single

Controls used in the form


Control for Control Type Properties Values

Entering Text ComboBox Name cmbGeneral

OK CommandButton Name cmdOK


Default True

Cancel CommandButton Name cmdCancel


Cancel True

Code
Private Sub cmdCancel_Click()
strSearchValue = ""

CNC © Aasiya Amin 81 DOEACC A-Levels Project


Unload Me
End Sub

Private Sub cmdOK_Click()


strSearchValue = cmbGeneral.Text
Unload Me
End Sub

Private Sub Form_Load()


Me.Left = (ALMain.ActiveForm.Width - Me.Width) / 2 +
ALMain.ActiveForm.Left
Me.Top = (ALMain.ActiveForm.Top + ALMain.ActiveForm.Height)
End Sub
Favorite Song Search Form
This form provides option to generate Reports of favorite Songs. It provides six different categories
of songs to choose from.

Favorite Song Search Form

Form Properties
Property Value

Name frmSongSearchReport

Caption Search for Favorite Songs

BorderStyle Fixed Single

MDIChild True

Controls used in the form

CNC © Aasiya Amin 82 DOEACC A-Levels Project


Control for Control Type Properties Values

General Songs Image Name imgGenSongs1, 2 & 3


(2 shades of Images) Picture General Songs Picture1 & 2

Romantic Songs Image Name imgRomSongs1, 2 & 3


(2 shades of Images) Picture Romantic Songs Picture 1 & 2

Birthday Songs Image Name imgBirthSongs1, 2 & 3


(2 shades of Images) Picture Birthday Songs Picture 1 & 2

Comedian Songs Image Name imgComeSongs1, 2 & 3


(2 shades of Images) Picture Comedian Songs Picture 1 & 2

Sad Songs Image Name imgSadSongs1, 2 & 3


(2 shades of Images) Picture Sad Songs Picture 1 & 2

Remix Songs Image Name imgRemixSongs1, 2 & 3


(2 shades of Images) Picture Remix Songs Picture 1 & 2

Exit Image Name imgExit1, 2 & 3


(2 shades of Images) Picture Exit Picture 1 & 2

Code
Dim rsTempSong As New adodb.Recordset

Private Sub Form_KeyPress(KeyAscii As Integer)


Select Case Chr(KeyAscii)
Case "G", "g"
imgGenSongs1_Click
Case "R", "r"
imgRomSongs1_Click
Case "B", "b"
imgBirthSongs1_Click
Case "C", "c"
imgComeSongs1_Click
Case "S", "s"
imgSadSongs1_Click
Case "M", "m"
imgRemixSongs1_Click
Case "X", "x"
imgExit1_Click
End Select
End Sub

CNC © Aasiya Amin 83 DOEACC A-Levels Project


Private Sub Form_Load()
Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle1.Left = (Me.ScaleWidth - lblTitle1.Width) / 2
lblTitle2.Left = (Me.ScaleWidth - lblTitle2.Width) / 2
getConnection
End Sub

Private Sub imgBirthSongs1_Click()


Call ShowSongReport("Birthday Songs", "")
End Sub

Private Sub imgBirthSongs1_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgBirthSongs1.Picture = imgBirthSongs3.Picture
End Sub

Private Sub imgBirthSongs1_MouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgBirthSongs1.Picture = imgBirthSongs2.Picture
End Sub

Private Sub imgComeSongs1_Click()


Call ShowSongReport("Comedian Songs", "")
End Sub

Private Sub imgComeSongs1_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgComeSongs1.Picture = imgComeSongs3.Picture
End Sub

Private Sub imgComeSongs1_MouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgComeSongs1.Picture = imgComeSongs2.Picture
End Sub

Private Sub imgExit1_Click()


Unload Me

CNC © Aasiya Amin 84 DOEACC A-Levels Project


frmReportCentre.Show
End Sub

Private Sub imgExit1_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgExit1.Picture = imgExit3.Picture
End Sub

Private Sub imgExit1_MouseUp(Button As Integer, Shift As Integer,


X As Single, Y As Single)
imgExit1.Picture = imgExit2.Picture
End Sub

Private Sub imgGenSongs1_Click()


On Error GoTo errHandler
Dim strQuery As String
strQuery = "Select Album.Code, AlbumDetail.Name,
AlbumContent.Artist1, "
strQuery = strQuery & "AlbumContent.Artist2,
AlbumContent.FirstLine "
strQuery = strQuery & "From (Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN AlbumContent ON
AlbumDetail.DetailID = AlbumContent.DetailID"
Call ShowSongReport("General", strQuery)
Exit Sub
errHandler:
End Sub

Private Sub imgGenSongs1_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgGenSongs1.Picture = imgGenSongs3.Picture
End Sub

Private Sub imgGenSongs1_MouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgGenSongs1.Picture = imgGenSongs2.Picture
End Sub

Private Sub imgRemixSongs1_Click()


Call ShowSongReport("Remix Songs", "")
End Sub

CNC © Aasiya Amin 85 DOEACC A-Levels Project


Private Sub imgRemixSongs1_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
imgRemixSongs1.Picture = imgRemixSongs3.Picture
End Sub

Private Sub imgRemixSongs1_MouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgRemixSongs1.Picture = imgRemixSongs2.Picture
End Sub

Private Sub imgRomSongs1_Click()


Call ShowSongReport("Romantic Songs", "")
End Sub

Private Sub imgRomSongs1_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgRomSongs1.Picture = imgRomSongs3.Picture
End Sub

Private Sub imgRomSongs1_MouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgRomSongs1.Picture = imgRomSongs2.Picture
End Sub

Private Sub imgSadSongs1_Click()


Call ShowSongReport("Sad Songs", "")
End Sub

Private Sub imgSadSongs1_MouseDown(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgSadSongs1.Picture = imgSadSongs3.Picture
End Sub

Private Sub imgSadSongs1_MouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)
imgSadSongs1.Picture = imgSadSongs2.Picture
End Sub

Private Sub ShowSongReport(strSongType As String, strQuery As


String)
On Error GoTo errHandler
Dim lblSongType1 As RptLabel
Dim lblSongType2 As RptLabel

Set rsSongSearch = New adodb.Recordset


If strQuery = "" Then

CNC © Aasiya Amin 86 DOEACC A-Levels Project


strQuery = "Select Album.Code, AlbumDetail.Name,
AlbumContent.Artist1, "
strQuery = strQuery & "AlbumContent.Artist2,
AlbumContent.FirstLine "
strQuery = strQuery & "From (Album INNER JOIN AlbumDetail ON
Album.AlbumID = AlbumDetail.AlbumID) "
strQuery = strQuery & "INNER JOIN AlbumContent ON
AlbumDetail.DetailID = AlbumContent.DetailID "
strQuery = strQuery & "Where (((AlbumContent.SongType) = '"
& strSongType & "'))"
End If
rsSongSearch.Open strQuery, conAudioLib, adOpenKeyset,
adLockOptimistic
Set rptSongSearch.DataSource = rsSongSearch
Set lblSongType1 = rptSongSearch.Sections(2).Controls(6)
lblSongType1.Caption = "Song Type : "
Set lblSongType2 = rptSongSearch.Sections(2).Controls(7)
lblSongType2.Caption = strSongType
rptSongSearch.Show
Exit Sub
errHandler:
End Sub

User Administration Form


This form provides interface for user administration, such as adding and deleting user, changing
user name or password etc. Only Administrator (Admin) has access to this form.

User Administration Form

Form Properties
Property Value

CNC © Aasiya Amin 87 DOEACC A-Levels Project


Name frmAddUser

Caption User Administration

BorderStyle Fixed Single

MDIChild True

Controls used in the form


Control for Control Type Properties Values

User Name TextBox Name txtUserName

Password TextBox Name txtPassword


PasswordChar “_”

Plus Common Control as shown above

Code
Dim rsTemp As adodb.Recordset

Private Sub cmdAdd_Click()


On Error GoTo errHandler
cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdEdit.Enabled = False
cmdDelete.Enabled = False
ClearControls
If txtUserName.Enabled = False Then
txtUserName.Enabled = True
End If
rsTemp.AddNew
txtUserName.SetFocus
Exit Sub
errHandler:
End Sub

Private Sub cmdCancel_Click()


On Error GoTo errHandler
cmdCancel.Enabled = False
cmdSave.Enabled = False
cmdEdit.Enabled = True

CNC © Aasiya Amin 88 DOEACC A-Levels Project


cmdAdd.Enabled = True
cmdDelete.Enabled = True
rsTemp.CancelUpdate
If rsTemp.RecordCount > 0 Then
Display
End If
Exit Sub
errHandler:
End Sub

Private Sub cmdDelete_Click()


On Error GoTo errHandler
rsTemp.Delete
rsTemp.MoveNext
If rsTemp.EOF Then rsTemp.MoveLast
Display
Exit Sub
errHandler:
End Sub

Private Sub cmdEdit_Click()


cmdAdd.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdEdit.Enabled = False
cmdDelete.Enabled = False
End Sub

Private Sub cmdExit_Click()


On Error GoTo errHandler
Unload Me
Exit Sub
errHandler:
End Sub

Private Sub cmdFirst_Click()


On Error GoTo errHandler
rsTemp.MoveFirst

CNC © Aasiya Amin 89 DOEACC A-Levels Project


Display
Exit Sub
errHandler:
End Sub

Private Sub cmdLast_Click()


On Error GoTo errHandler
rsTemp.MoveLast
Display
Exit Sub
errHandler:
End Sub

Private Sub cmdNext_Click()


On Error GoTo errHandler
rsTemp.MoveNext
If rsTemp.EOF Then rsTemp.MoveLast
Display
Exit Sub
errHandler:
End Sub

Private Sub cmdPrevious_Click()


On Error GoTo errHandler
rsTemp.MovePrevious
If rsTemp.BOF Then rsTemp.MoveFirst
Display
Exit Sub
errHandler:
End Sub

Private Sub cmdSave_Click()


On Error GoTo errHandler
cmdCancel.Enabled = False
cmdSave.Enabled = False
cmdEdit.Enabled = True
cmdAdd.Enabled = True
cmdDelete.Enabled = True

CNC © Aasiya Amin 90 DOEACC A-Levels Project


SaveRecords
Exit Sub
errHandler:
End Sub

Private Sub Form_Load()


Me.Left = (ALMain.ScaleWidth - Me.Width) / 2
Me.Top = (ALMain.ScaleHeight - Me.Height) / 2
lblTitle.Left = (Me.ScaleWidth - lblTitle.Width) / 2
Set rsTemp = New adodb.Recordset
On Error GoTo errHandler
getConnection
rsTemp.Open "Select * from Login", conAudioLib, adOpenKeyset,
adLockPessimistic, adCmdText
If rsTemp.RecordCount > 0 Then
rsTemp.MoveFirst
Display
End If
cmdSave.Enabled = False
cmdCancel.Enabled = False
Exit Sub
errHandler:
MsgBox Err.Description, vbInformation + vbOKOnly, "Error..."
End Sub

Public Sub ClearControls()


On Error GoTo errHandler
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
Exit Sub
errHandler:
End Sub

Public Sub SaveRecords()


On Error GoTo errHandler
rsTemp!Username = txtUserName.Text
rsTemp!Password = txtPassword.Text

CNC © Aasiya Amin 91 DOEACC A-Levels Project


rsTemp.Update
Exit Sub
errHandler:
End Sub

Public Sub Display()


On Error GoTo errHandler
txtUserName.Text = rsTemp!Username
If txtUserName.Text = "Admin" Then
txtUserName.Enabled = False
Else
txtUserName.Enabled = True
End If
txtPassword.Text = rsTemp!Password
Exit Sub
errHandler:
End Sub

The Main Standard Module: modALMain.bas


This standard module contains general-line functions and public object and variable used
throughout the project.

Objects and variable used in the module


Object / Variable Data Type / Class Access Specifier Description

blnLogin Boolean Public To store status of Login of the user while


application is executing. The possible
values are “True” or “False”

conAudioLib adodb.Connection Public Connection object of ADO to connection


with the Oracle or Access database at
runtime

rsSongSearch adodb.Recordset Public Recordset object of ADO to store record


sets retrieved from the database

strProvider String Public Stores the name of the Data Provider. For
Oracle it is “MSDASQL” and for Access it is
“Microsoft.Jet.OLEDB.4.0”

strSearchValue String Public Stores the searched value for further


processing in different modules

strReportCaption String Public Stores the Caption to be used in Report at


Runtime, especially in General Report.

Functions used in the module

CNC © Aasiya Amin 92 DOEACC A-Levels Project


Function name Return List of arguments Purpose
Type

getConnection() Nil Nil To allocate memory to Connection object at


runtime and connect with the database. This
function is invoked when the Main form is
loaded in memory

addNewData() String ByVal strTableName(String) To adds new data item in the Two Column
Tables such as Artist Table, Director Table etc
ByVal strFieldName(String) in Data Entry Forms. This is invoked when
ellipses (…) is clicked in Data Entry Forms.

showDialog String ByVal strCaption(String) To fill up Combo List in General Dialog Form
with values from database.

Code
Public blnLogin As Boolean
Public conAudioLib As adodb.Connection
Public rsSongSearch As adodb.Recordset
Public strProvider As String
Public strSearchValue As String
Public strReportCaption As String

Public Function getConnection()


Set conAudioLib = New adodb.Connection
If strProvider = "ACCESS" Then
conAudioLib.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & App.Path & "\ALMS.mdb;Jet OLEDB:Database Password=alms"
Else
conAudioLib.Open "Provider=MSDASQL;Data Source=ALMS",
"alms", "alms"
End If
End Function

Public Function addNewData(ByVal strTableName As String, ByVal


strFieldName As String) As String
On Error GoTo errHandler

Dim intNewValue As Integer


Dim strLS As String
Dim rsTemp As New adodb.Recordset

rsTemp.Open "Select * from " + strTableName + " Order By " +


strFieldName, conAudioLib, adOpenKeyset, adLockOptimistic,
adCmdText
If rsTemp.RecordCount > 0 Then
rsTemp.MoveLast

CNC © Aasiya Amin 93 DOEACC A-Levels Project


intNewValue = rsTemp.Fields(0).Value + 1
Else
intNewValue = 1
End If
strLS = InputBox("Enter new Value", "Adding Record...")
If strLS <> "" Then
rsTemp.AddNew
rsTemp.Fields(0).Value = intNewValue
rsTemp.Fields(1).Value = strLS
rsTemp.Update
addNewData = strLS
End If
rsTemp.Close
Exit Function

errHandler:
MsgBox Err.Description
addNewData = ""
End Function

Public Function showDialog(ByVal strCaption As String, ByVal


strTableName As String, ByVal strFieldName As String) As String
On Error Resume Next

Dim strSql As String


Dim rsTemp As New adodb.Recordset

strSql = "Select " & strFieldName & " From " & strTableName
getConnection
rsTemp.Open strSql, conAudioLib, adOpenKeyset, adLockOptimistic
Do While Not (rsTemp.EOF)
frmDialog.cmbGeneral.AddItem
rsTemp.Fields(strFieldName).Value & ""
rsTemp.MoveNext
Loop
frmDialog.Caption = strCaption
frmDialog.lblGeneral.Caption = strCaption
frmDialog.Show vbModal, ALMain
rsTemp.Close
showDialog = Trim(strSearchValue)
End Function

CNC © Aasiya Amin 94 DOEACC A-Levels Project


Reports
The ALMS can generate Reports based on different types of queries. These Report provide the user
with the hard copy of database, which can be made available anytime. The project is using the
following Three Reports designers to generate Reports:

 RptFilmWise
 rptGeneral
 rptSongSearch
There are two ways to generate Reports in ALMS:
1. By Song Search by First Line.
2. Reporting Centre
Song Search by First Line option retrieved the related songs from the database and generates a
Report, which displays all the songs satisfying the criteria.
Through Reporting Centre, a Report can be generated in following five ways:
1. By Year-wise.
2. By Selected Lyricist.
3. By Film-wise
4. By Selected Composer.
5. By Selected Singer.
In addition a Report can be generated in six different ways, using the Choice Songs in Reporting
Centre. These Six categories are:
1. General Song’s category.
2. Romantic Songs category.
3. Birthday Songs category.
4. Comedian Songs category.
5. Sad Songs category.
6. Remix Songs category.

CNC © Aasiya Amin 95 DOEACC A-Levels Project


A Report Generated through Reporting Centre Year Wise

ALMS Help
ALMS have On-Line Help support. A user can use the help support for choose Help menu or by
pressing F1 key.

ALMS On-Line Help

Suggested Enhancements

1. We can provide hardware interface to automate the process of retrieving favorite song from the
database and then playing that song. We can provide the interface with the Audio Player used by
the Prasar Bharati.
2. We can provided network interface so that ALMS can run on multiple clients to connected different
stations across the country
3. There is a provision to included internet version for the Listener using Web Forms, wherein
Listeners can choose there favorite song and Listen to it from any where in the world.
4. Presently ALMS Help is not context sensitive. We can make the On-Line Help system context
sensitive, so that the help for specific topic can be obtained from any point.
5. We can automate the process of create ODBC Driver for oracle, so that user is not bothered to do

CNC © Aasiya Amin 96 DOEACC A-Levels Project


so.

Conclusion

Working on the project was a good experience. I understood the importance of


planning and designing as a part of software development.

The concept of peer-reviews helped to rectify the problems as and when they
occurred and also helped me to get some valuable suggestions that were incorporated
by me.

Developing the project has helped me to gain some experience on real-time


development procedures.

CNC © Aasiya Amin 97 DOEACC A-Levels Project


INSTRUCTIONS F OR EXECUTING P ROJECTS

The following points should be followed to install the project for the first time:
1. Insert the ALMS CD-ROM in DR-ROM Drive and choose Start->Run
2. Type “D:\setup”, assuming that your CD-ROM Drive letter is “D”. If your CD-ROM
Drive letter is different, then you must change the letter accordingly.
3. The setup program will start and follow the setup on the screen.
4. After this setup, ALMS installation will be complete.

Creating ODBC Driver


If you are using ALMS with Oracle support then the following steps should be used to create the
ODBC Driver to access Oracle database:
1. Open Control Panel by choosing Start->Settings->Control Panel in Windows 95/98
2. Double Click on ODBC Data Source [32 bit].
3. In the User DSN Tab click on Add…
4. Select “Microsoft ODBC for Oracle” from the list of drivers and click Finish.
5. Type Data Source Name, User Name and Server [optional].

You are now ready to use Audio Library Management System. Enjoy it!

CNC © Aasiya Amin 98 DOEACC A-Levels Project

You might also like