farooq mirza

63
ON “RAILWAY RESERVATION SYSTEM” 1

Upload: puneet-chawla

Post on 29-Nov-2015

34 views

Category:

Documents


1 download

TRANSCRIPT

ON

“RAILWAY RESERVATION SYSTEM”

Developed By: Under the guidance of: Farooz Mirza

1

CERTIFICATE

It is to certify that Farooz Mirza has satisfactorily completed the project work,

“RAILWAY RESERVATION SYSTEM” for the 12th class.

Sig. of Project Guide Sig. of Academic Head( ) ( )

2

ACKNOWLEDGEMENT

I have conceived that it is virtually impossible for me to undertake and complete a

project of this kind without the encouragement, guidance and assistance from our

teachers and friends. Preparing any project requires views of many peoples but I

suspect those technical projects are more difficult than others. A great many

people are involved in various stages of the project preparation that shared their

knowledge and experience.

At the very outset I express my heartful gratitude to and the

administration of the school for giving me opportunity to complete the project well

in time.

Lastly I would like to thank to all my friends for sharing their experiences of

software and specially my parents whose principles and morale support helped

me to rise to this position in which I am in today.

Farooz Mirza

Introduction

3

Project on Railway Reservation is developed by Farooz Mirza

for providing fully computerized system of Railway

reservation to users.

With the help of this project, we are making efforts to fully

computerize the systems of Railway by providing different

services to the railway.

Configuration

4

Hardware Requirement

1)RAM 128 MB (Min)

2)HARDDISk 40 GB

3)MONITOR 15”

4)PROCESSOR Intel Pentium II

SOFTWARE REQUIREMENT

1) FRONTEND Visual Basis 6.0

2) BACKEND Microsoft Access

2003

3) OPERATING SYSTEM Microsoft XP SP-2

5

Languages / Packages Used

The various languages / tools that are used during the

development of the project are:

Visual Basic: The Visual Basic is used as our main tool

for the development of the project. This tool is used as

front-end of the application. The whole application has

been created using this. It is a very powerful object

oriented programming language through which we can

design our application by creating different forms,

modules, reports etc. However, some other tools also

have been used.

Microsoft Access 7.0: This tool is used basically to

work within database. This tool is used as back-end of

the application. It is a Package of Microsoft and we can

create the design of table and can enter the records in

table. As well as, we can create forms, queries, reports,

macro’s and module by using this package.

Database Connectivity: The project is also having

database connectivity which in turn uses Access for

storing the database.

6

VISUAL BASIC

Visual basic, is the fastest and easiest way to create

applications for Microsoft Windows®. Whether we are an

experienced professional or brand new to windows

programming. Visual basic provides you with a set of tools to

simplify rapid application development.

In visual Basic, “visual” part refers to the method used

to create the graphical user interface (GUI). Rather than

writing numerous lines of code to describe the appearance

and location of interface elements, we simply add prebuilt

objects into place on screen. If you’ve ever

DatabaseDatabase is a collection of data. Our phone book is a simple

database and so our checkbook. A history of a company’s

orders, invoices and payments is an example of a more

complicated database, as is a log of salesperson’s contracts

with clients and any related follow-up plans.

Ms-Access

In Ms-Access a database is a collection of information that is

related to a particular subject stored in the form of table. Ms-

Access is a very powerful RDBMS which manages data in

term of special table called relation. Using Ms-Access we can

7

manage all information from a single database file. Database

files are stored with extension .mdb.

What can Access do for us?

Access stores information in the form of tables and build our

database on its bases. Each row in a table holds all

information’s and for a particular person it is called a record

and each column contains different pieces of information.

In Access we have few things known as Tables, Form,

Reports and Queries. They allow us to check and get desired

information as and when required.

TECHNOLOGIESActiveX Data Objects

ActiveX: An ActiveX control is an extension to the visual

basic toolbox. We use ActiveX just as we would any of the

standard built-in controls, such as the checkbox control.

When we add an ActiveX control to a program, it becomes

part of the development and runtime environment and

provides new functionality for our application.

In Visual basic, three data access interfaces are

available to us: ActiveX data Object (ADO), remote Data

Object (RDO) and Data

Access Object (DAO). A Data Access Interface is an object

model that represents various facts of accessing data. Using

Visual Basic, we can programmatically control the

8

connection, statements builders and returned data for use in

any application.

For new projects we should use Ado as our data

access interface.

Why use ADO?Ado is designed as an easy-to use application level interface

to Microsoft’s newest and most powerful data access

paradigm, OLEDB. OLEDB provide high performance access

to any data source, including rational and non rational

databases, email and file systems, text and graphics, custom

business objects and more. ADO is implemented for minimal

network traffic key.

Internet scenarios and a minimal number of layers

between the front-end and data source-all to provide a

lightweight, high performance interface. ADO is called using

a familiar metaphor-the OLE automation interface. And ADO

uses conventions and features similar to DAO and RDO, with

simplified semantics that make it easy to learn.

OLE The OLE (Object Linking and Embedding) is a method for

sharing data between windows based applications. OLE

allows us to develop an application where we can access the

best features from many different Windows based

applications

CODING

Introduction

9

The coding step performs the translation of the design

representations into an artificial language resulting in

instructions that can be executed by the computer. It thus

involves developing computer program that meet the

system specification of the design stage. Since the project is

to be implemented on the web, the two aspects: Visual

Interface Design and the efficiency of coding have been

given special emphasis.

Visual Interface Design

The user interface is perhaps the most important part of an

application. It’s certainly the most visible. To users, the

interface is the application, they probably aren’t aware of

the code that is executing behind the scenes. No matter how

much time and effort we put into writing and optimizing our

code. The usability of our application depends on the

interface.

Coding Conventions

Programming guidelines that focus not only on the logic of

the program but on its physical structure and appearance.

They make the code easier to read, understand and

maintain. Following coding conventions must be kept in mind

while coding:

Guidelines for spacing, formatting and indenting.

Standardized formats for labeling and commenting code.

Naming conventions for object, variables and

procedures.

10

Dim ATI As StringDim ATS As StringDim ATT As StringDim ACL As String

Private Sub AddAmoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Index = 4 ThenIf AddAmoText(Index).Text <> "" ThenOn Error GoTo abcAddAmoText(Index).Text = CInt(AddAmoText(Index).Text)SaveTrain.SetFocusEnd IfEnd IfIf Index < 4 ThenIf AddAmoText(Index).Text <> "" ThenOn Error GoTo abcAddAmoText(Index).Text = CInt(AddAmoText(Index).Text)Index = Index + 1AddStaysText(Index).SetFocusElseSaveTrain.SetFocusEnd If

End IfEnd If

Exit Sub

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the only Number"AddAmoText(Index).Text = ""End Select

End Sub

Private Sub AddClassCheck_Click(Index As Integer)If AddClassCheck(Index).Value = 1 ThenAddClassMultiAmo(Index).Visible = TrueAddClassMultiAmo(Index).SetFocusEnd IfEnd Sub

Private Sub AddClassMultiAmo_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenIf AddClassMultiAmo(Index).Text = "" ThenAddClassMultiAmo(Index).SetFocusElseIf Index <= 6 ThenOn Error GoTo abcAddClassMultiAmo(Index).Text = CInt(AddClassMultiAmo(Index).Text)If Index = 6 Then

11

AddStaysText(0).SetFocusEnd IfIndex = Index + 1If Index <= 6 ThenAddClassCheck(Index).SetFocusEnd IfEnd IfEnd IfEnd IfExit Sub

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the only Number"AddClassMultiAmo(Index).Text = ""AddClassMultiAmo(Index).SetFocusEnd Select

End Sub

Case 13MsgBox "Please Enter the only Number"ATAgeText(Index).Text = ""End Select

End Sub

Private Sub aTNOPassText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf ATNOPassText(0).Text = "" ThenATNOPassText(0).SetFocusElseIf Index <= 4 ThenATNOPassText(Index).SetFocus

If ATNOPassText(Index).Text <> "" ThenEnd IfEnd If

Ticket

For Index = 0 To 4If ATNOPassLabel(Index).Visible = True Thens = "insert into save_data values(" & sns = s & "," & ATTNoLabel.Caption & ",'"s = s & ATTrNoLabel.Caption & "','"s = s & ATTrNLabel.Caption & "','"s = s & ATStFrLabel.Caption & "','"s = s & ATStToLabel.Caption & "','"s = s & ATDOJouLabel.Caption & "','"s = s & ATClsLabel.Caption & "','"s = s & ATCatLabel.Caption & "','"s = s & ATCoTraAuthNoLabel.Caption & "','"

12

s = s & ATNOPassLabel(Index).Caption & "',"s = s & ATAgeLabel(Index).Caption & ",'"s = s & ATSexLabel(Index).Caption & "','"s = s & ATSeMoLabel(Index).Caption & "',"s = s & ATSeNoLabel(Index).Caption & ",'"s = s & ATQtaLabel(Index).Caption & "','"s = s & ATAddLabel.Caption & "',"s = s & ATAmoLabel(Index).Caption & ",'Advance')"sn = sn + 1ElseExitfr.SetFocusExit SubEnd Ifcn.Execute sNextExitfr.SetFocusEnd Sub

Private Sub ATClscombo_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenIf ATClsCombo.Text = "" ThenMsgBox "Plase select The Class"Exit Sub

Else

class

cl.Find "train_no='" & ATTrNoCombo.Text & "'"cl.Find "class='" & ATClsCombo.Text & "'"

If cl.EOF = True Or cl.BOF = True ThenMsgBox "Please select The dragdrop Class"cl.CloseExit SubEnd If

cl.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenNextFr.SetFocusEnd If

End Sub

Private Sub ATDOJouText_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenIf ATDOJouText.Text = "" ThenMsgBox "Please Enter The Date"ElseOn Error GoTo abc

13

ATDOJouText.Text = Format$(CDate(ATDOJouText.Text), "dd/mmm/yyyy")If KeyCode = vbKeyReturn ThenATClsCombo.SetFocusEnd IfEnd IfEnd If

If ts(0) = ATTrNoCombo.Text ThenATStToCombo.AddItem ts(1)End IfWend

ts.Close

If KeyCode = vbKeyReturn ThenATStToCombo.SetFocusEnd If

End Sub

Private Sub ATStToCombo_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf ATStToCombo.Text = "" ThenMsgBox "Please Select Station"Exit Sub

Else

train_timestt.Find "train_no='" & ATTrNoCombo.Text & "'"tt.Find "train_station ='" & ATStToCombo.Text & "'"

If tt.EOF = True Or tt.BOF = True ThenMsgBox "Please select The dragdrop Station"tt.CloseExit SubEnd If

tt.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenATDOJouText.SetFocusEnd If

End Sub

Private Sub ATTNoCombo_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenATTrNoCombo.SetFocusEnd If

14

End Sub

Private Sub ATTrNCombo_Click()train_infoti.Find "train_name='" & ATTrNCombo.Text & "'"ATTrNoCombo.Text = ti(0)ATDepStOTrLabel.Caption = ti(2)ATDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATStFrCombo.ClearATStToCombo.Clear

ts.Find "train_no='" & ATTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = ATTrNoCombo.Text ThenATStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATClsCombo.Clear

cl.Find "train_no='" & ATTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = ATTrNoCombo.Text ThenATClsCombo.AddItem cl(1)End Ifcl.MoveNextWend

cl.Close

End Sub

Private Sub ATTrNCombo_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn Then

15

If ATTrNCombo.Text = "" ThenMsgBox "Please Select Train"Exit Sub

Else

train_infoti.Find "train_name='" & ATTrNCombo.Text & "'"

If ti.EOF = True Or ti.BOF = True ThenMsgBox "Please select The dragdrop Train Name"ti.CloseExit SubEnd If

ATTrNoCombo.Text = ti(0)ATDepStOTrLabel.Caption = ti(2)ATDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATStFrCombo.ClearATStToCombo.Clear

ts.Find "train_no='" & ATTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = ATTrNoCombo.Text ThenATStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATClsCombo.Clear

cl.Find "train_no='" & ATTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = ATTrNoCombo.Text ThenATClsCombo.AddItem cl(1)End If

16

cl.MoveNextWend

cl.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenATStFrCombo.SetFocusEnd If

End Sub

Private Sub ATTrNoCombo_Click()train_infoti.Find "train_no='" & ATTrNoCombo.Text & "'"ATTrNCombo.Text = ti(1)ATDepStOTrLabel.Caption = ti(2)ATDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATStFrCombo.ClearATStToCombo.Clear

ts.Find "train_no='" & ATTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = ATTrNoCombo.Text ThenATStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATClsCombo.Clear

cl.Find "train_no='" & ATTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = ATTrNoCombo.Text ThenATClsCombo.AddItem cl(1)

17

End Ifcl.MoveNextWend

cl.Close

End Sub

Private Sub ATTrNoCombo_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn Then

If ATTrNoCombo.Text = "" ThenMsgBox "Please Select Train"Exit Sub

Else

train_infoti.Find "train_no='" & ATTrNoCombo.Text & "'"

If ti.EOF = True Or ti.BOF = True ThenMsgBox "Please select The dragdrop Train No."ti.CloseExit SubEnd If

ATTrNCombo.Text = ti(1)ATDepStOTrLabel.Caption = ti(2)ATDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

ATStFrCombo.ClearATStToCombo.Clear

ts.Find "train_no='" & ATTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = ATTrNoCombo.Text ThenATStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True Then

18

MsgBox "No Train Stays Exist"End If

ATClsCombo.Clear

cl.Find "train_no='" & ATTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = ATTrNoCombo.Text ThenATClsCombo.AddItem cl(1)End Ifcl.MoveNextWend

cl.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenATTrNCombo.SetFocusEnd If

End Sub

Private Sub NextFr_Click()cn.Close

ATPassINFO.ShowATPassINFO.ATCatCombo.SetFocus

End Sub

Private Sub Form_Load()DDate.Caption = Format$(Now, "dd/mmm/yyyy")

conect

Ticket

If tn.EOF = True Or tn.BOF = True ThenATTNoLabel.Caption = 1Elsetn.MoveLastATTNoLabel.Caption = tn(1) + 1End If

tn.Close

train_info

If ti.EOF = True And ti.BOF = True ThenMsgBox "Not Any Train Exist"ti.CloseExit SubEnd If

19

ti.MoveFirstATTrNoCombo.Text = ti(0)ATTrNCombo.Text = ti(1)

While Not ti.EOFATTrNoCombo.AddItem ti(0)ATTrNCombo.AddItem ti(1)ti.MoveNextWend

ti.Close

End Sub

Private Sub Form_Unload(Cancel As Integer)On Error Resume NextUnload MeEnd Sub

Dim deltr, delts As String

Private Sub DeleTrain_Click()deltr = "Delete from train_info where train_no='" & DelTrNoText.Text & "'"cn.Execute deltr

deltr = "Delete from train_stays where train_no='" & DelTrNoText.Text & "'"cn.Execute deltr

deltr = "Delete from train_times where train_no='" & DelTrNoText.Text & "'"cn.Execute deltr

deltr = "Delete from class where train_no='" & DelTrNoText.Text & "'"cn.Execute deltr

cn.Close

End Sub

Private Sub DelTrNoText_KeyDown(KeyCode As Integer, Shift As Integer)VisibltyIf KeyCode = vbKeyReturn ThenIf DelTrNoText.Text = "" ThenMsgBox "Please Enter The Train No."DelTrNoText.SetFocusDelTrNoText.Text = ""Else

train_info

If ti.EOF = True And ti.BOF = True ThenMsgBox "No Exist Any Train"ti.CloseExit SubEnd If

20

ti.MoveFirstWhile Not ti.EOFIf ti(0) = DelTrNoText.Text ThenDelTrNLabel.Visible = TrueDelDepStOTrLabel.Visible = TrueDelDesStOTrLabel.Visible = True

DelTrNLabel.Caption = ti(1)DelDepStOTrLabel.Caption = ti(2)DelDesStOTrLabel.Caption = ti(3)End Ifti.MoveNextWend

ti.Close

If DelTrNLabel.Visible = False ThenMsgBox "This Train No. Is Not Exist"DelTrNoText.SetFocusElseDeleTrain.SetFocusEnd IfEnd IfEnd If

End Sub

Private Sub Form_Load()

conect

End Sub

Public Sub Visiblty()DelTrNLabel.Visible = FalseDelDepStOTrLabel.Visible = FalseDelDesStOTrLabel.Visible = False

End Sub

Private Sub mnuaddnewtrain_Click()On Error Resume NextUnload MeAddNewTrain.ShowAddNewTrain.AddTrNoText.SetFocusEnd Sub

Private Sub mnuadvanceticket_Click()On Error Resume NextUnload MeATS.ShowATS.ATTrNoCombo.SetFocusEnd Sub

Private Sub mnucurrentticket_Click()

21

On Error Resume NextUnload MeNTS.ShowNTS.NTTrNoCombo.SetFocusEnd Sub

Private Sub mnudeletetrain_Click()On Error Resume NextUnload MeDelTrain.ShowDelTrain.DelTrNoText.SetFocusEnd Sub

Private Sub mnuquit_Click()EndEnd Sub

Private Sub mnureportofamount_Click()On Error Resume NextUnload MeROAmu.ShowROAmu.Text1.SetFocusEnd Sub

Private Sub mnureportofticket_Click()On Error Resume NextUnload MeROTic.ShowROTic.Text1.SetFocusEnd Sub

Private Sub mnuticketcancelation_Click()On Error Resume NextUnload MeTC.ShowTC.TCTNoText.SetFocusEnd Sub

Dim clss, stf, stt, less, i, ap, Index As Integer

Private Sub BackFr_Click()On Error Resume Nextcn.CloseUnload MeNTPassINFO.ShowEnd Sub

Private Sub Form_Load()

i = 0stf = 0stt = 0NTTrNoLabel = NTPassINFO.NTTrNoLabelNTTrNLabel = NTPassINFO.NTTrNLabelNTStFrLabel = NTPassINFO.NTStFrLabelNTStToLabel = NTPassINFO.NTStToLabel

22

NTClsLabel = NTPassINFO.NTClsLabelNTCatLabel = NTPassINFO.NTCatCombo

For Index = 0 To 4If NTPassINFO.NTNOPassText(Index).Text <> "" Theni = i + 1End IfNext

class

cl.Find "class='" & NTClsLabel.Caption & "'"clss = cl(2)

cl.Close

train_stays

ts.Find "train_no='" & NTTrNoLabel.Caption & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = NTTrNoLabel.Caption ThenIf ts(1) = NTStFrLabel.Caption Thenstf = ts(2)End IfEnd Ifts.MoveNextWend

ts.MoveFirst

While Not ts.EOFIf ts(0) = NTTrNoLabel.Caption ThenIf ts(1) = NTStToLabel.Caption Thenstt = stt + ts(2)End IfEnd Ifts.MoveNextWend

ts.Close

categorycat.MoveFirstcat.Find "category='" & NTCatLabel.Caption & "'"

less = cat(1)

cat.Close

NTNoOPassLabel.Caption = iNTAmoLabel.Caption = ((stt - stf) * clss) * iap = (stt - stf) * clssNTQtaLabel.Caption = less & "%"NTLessLabel.Caption = NTAmoLabel.Caption * (less / 100)

23

NTNetAmoLabel.Caption = NTAmoLabel.Caption - NTLessLabel.Caption

For Index = 0 To 4NTPassINFO.NTAmoLabel(Index).Caption = apNext

End Sub

Private Sub NextFr_Click()cn.CloseNTPassINFO.ShowNTPassINFO.NTToAmtLabel = NTNetAmoLabelUnload MeNTPassINFO.NextFr.SetFocusEnd Sub

Private Sub Form_Load()

DDate.Caption = NTS.DDateNTTNoLabel = NTS.NTTNoLabelNTTrNoLabel = NTS.NTTrNoComboNTTrNLabel = NTS.NTTrNComboNTDepStOTrLabel = NTS.NTDepStOTrLabelNTDesStOTrLabel = NTS.NTDesStOTrLabelNTStFrLabel = NTS.NTStFrComboNTStToLabel = NTS.NTStToComboNTTOArrLabel = NTS.NTTOArrLabelNTTODepLabel = NTS.NTTODepLabelNTDOJouLabel = NTS.NTDOJouTextNTClsLabel = NTS.NTClsCombo

For Index = 0 To 4NTAmoLabel(Index).Visible = FalseNext

conectcategory

If cat.EOF = True And cat.BOF = True ThenMsgBox "Not Exist Any Catagory"cat.CloseExit SubEnd If

cat.MoveFirst

While Not cat.EOF

NTCatCombo.AddItem cat(0)cat.MoveNextWend

cat.Close

End Sub

24

Private Sub Form_Unload(Cancel As Integer)On Error Resume Nextcn.Close

End Sub

Private Sub NextFr_Click()On Error Resume Nextcn.CloseNTPasTicINFO.ShowNTPasTicINFO.SaveData.SetFocusUnload MeEnd Sub

Private Sub NTAddText_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenNTAmount.ShowEnd If

End Sub

Private Sub NTAgeText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then

If NTAgeText(Index).Text <> "" ThenOn Error GoTo abcNTAgeText(Index).Text = CInt(NTAgeText(Index).Text)If NTCatCombo.Text = "Sr. Citizen" ThenIf NTAgeText(Index).Text > 65 ThenNTSexText(Index).SetFocusElseMsgBox "You are select the Sr. Citizen"NTAgeText(Index).SetFocusNTAgeText(Index).Text = ""Exit SubEnd IfEnd If

NTSexText(Index).SetFocusElseMsgBox "Please Enter the Age"End If

End If

Exit Sub

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the only Number"NTAgeText(Index).Text = ""End Select

End Sub

25

Private Sub NTCatCombo_Click()categorycat.Find "Category='" & NTCatCombo.Text & "'"

For Index = O To 4NTQtaLabel(Index).Caption = cat(1) & "%"Nextcat.CloseEnd Sub

Private Sub NTCatCombo_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf NTCatCombo.Text = "" ThenMsgBox "Please Select Category"Exit SubElsecategorycat.Find "Category='" & NTCatCombo.Text & "'"

If NTCatCombo.Text <> "" ThenIf cat.EOF = True Or cat.BOF = True ThenMsgBox "Please Select Any One Category in Drogdrop List"cat.CloseExit SubEnd IfEnd IfFor Index = O To 4NTQtaLabel(Index).Caption = cat(1) & "%"Next

cat.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenIf NTCatCombo.Text = "General" ThenNTCoTraAuthNoText = "N.A"NTNOPassText(0).SetFocusElseNTCoTraAuthNoText.SetFocusNTCoTraAuthNoText.Text = ""End IfEnd If

End Sub

Private Sub NTCoTraAuthNoText_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf NTCoTraAuthNoText.Text <> "" ThenNTNOPassText(0).SetFocusEnd IfEnd IfEnd Sub

26

Private Sub NTNOPassText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf NTNOPassText(0).Text = "" ThenNTNOPassText(0).SetFocusElseIf Index <= 4 ThenNTNOPassText(Index).SetFocus

If NTNOPassText(Index).Text <> "" ThenNTAgeText(Index).SetFocusElseNTAddText.SetFocusEnd If

End IfEnd IfEnd If

End Sub

Private Sub NTSeMoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then

If NTSeMoText(Index).Text <> "" ThenIf NTSeMoText(Index).Text = "Seat" Or NTSeMoText(Index).Text = "Berth" ThenNTAmoLabel(Index).Visible = TrueNTSeNoText(Index).SetFocusElseMsgBox "Please Enter Only Seat/Berth"NTSeMoText(Index).Text = ""End IfEnd If

End IfEnd Sub

Private Sub NTSeNoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Index = 4 ThenIf NTSeNoText(Index).Text <> "" ThenOn Error GoTo abcNTSeNoText(Index).Text = CInt(NTSeNoText(Index).Text)If NTSeNoText(Index).Text <= 50 ThenTicket

tn.MoveFirst

While Not tn.EOFIf tn!train_no = NTTrNoLabel.Caption ThenIf tn(6) = CDate(NTDOJouLabel.Caption) ThenIf tn!class = NTClsLabel.Caption ThenIf tn!seat_mode = NTSeMoText(Index).Text ThenIf tn!seat_berth_no <> NTSeNoText(Index).Text ThenNTAddText.SetFocusElseMsgBox "This Seat/Berth No. is Reserved"

27

NTSeNoText(Index).SetFocusNTSeNoText(Index).Text = ""GoTo aEnd IfElseNTAddText.SetFocusEnd IfElseNTAddText.SetFocusEnd IfElseNTAddText.SetFocusEnd IfElseNTAddText.SetFocusEnd Iftn.MoveNextWend

a:tn.Close

ElseMsgBox "Please Enter the 1 to 50 Seat No."NTSeNoText(Index).Text = ""End IfEnd IfElseIf NTSeNoText(Index).Text <> "" ThenOn Error GoTo abcIf NTSeNoText(Index).Text <= 50 Then

If Index > 0 And Index <= 4 ThenIf NTSeMoText(Index - 1).Text = NTSeMoText(Index).Text ThenIf NTSeNoText(Index - 1).Text = NTSeNoText(Index).Text ThenMsgBox "Not Repeat The Seat/Berth No."NTSeNoText(Index).Text = ""Exit SubEnd IfEnd IfEnd If

Ticket

On Error Resume Nexttn.MoveFirstIf tn.EOF = True And tn.BOF = True ThenIf tn!train_no = NTTrNoLabel.Caption ThenIf tn(6) = CDate(NTDOJouLabel.Caption) ThenIf tn!class = NTClsLabel.Caption ThenIf tn!seat_mode = NTSeMoText(Index).Text ThenIf tn!seat_berth_no <> NTSeNoText(Index).Text Then

End IfEnd Sub

28

Private Sub NTSeNoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Index = 4 ThenIf NTSeNoText(Index).Text <> "" ThenOn Error GoTo abcNTSeNoText(Index).Text = CInt(NTSeNoText(Index).Text)If NTSeNoText(Index).Text <= 50 ThenTicket

tn.MoveFirst

While Not tn.EOFIf tn!train_no = NTTrNoLabel.Caption ThenIf tn(6) = CDate(NTDOJouLabel.Caption) ThenIf tn!class = NTClsLabel.Caption ThenIf tn!seat_mode = NTSeMoText(Index).Text ThenIf tn!seat_berth_no <> NTSeNoText(Index).Text ThenNTAddText.SetFocusElseMsgBox "This Seat/Berth No. is Reserved"NTSeNoText(Index).SetFocusNTSeNoText(Index).Text = ""GoTo aEnd IfElseNTAddText.SetFocusEnd IfElseNTAddText.SetFocusEnd IfElseNTAddText.SetFocusEnd IfElseNTAddText.SetFocusEnd Iftn.MoveNextWend

a:tn.Close

ElseMsgBox "Please Enter the 1 to 50 Seat No."NTSeNoText(Index).Text = ""End IfEnd IfElseIf NTSeNoText(Index).Text <> "" ThenOn Error GoTo abcIf NTSeNoText(Index).Text <= 50 Then

If Index > 0 And Index <= 4 ThenIf NTSeMoText(Index - 1).Text = NTSeMoText(Index).Text ThenIf NTSeNoText(Index - 1).Text = NTSeNoText(Index).Text Then

29

MsgBox "Not Repeat The Seat/Berth No."NTSeNoText(Index).Text = ""Exit SubEnd IfEnd IfEnd If

Ticket

On Error Resume Nexttn.MoveFirstIf tn.EOF = True And tn.BOF = True ThenIf tn!train_no = NTTrNoLabel.Caption ThenIf tn(6) = CDate(NTDOJouLabel.Caption) ThenIf tn!class = NTClsLabel.Caption ThenIf tn!seat_mode = NTSeMoText(Index).Text ThenIf tn!seat_berth_no <> NTSeNoText(Index).Text ThenNTNOPassText(Index + 1).SetFocusEnd IfEnd IfEnd IfEnd IfEnd IfEnd If

While Not tn.EOFIf tn!train_no = NTTrNoLabel.Caption ThenIf tn(6) = CDate(NTDOJouLabel.Caption) ThenIf tn!class = NTClsLabel.Caption ThenIf tn!seat_mode = NTSeMoText(Index).Text ThenIf tn!seat_berth_no <> NTSeNoText(Index).Text ThenNTNOPassText(Index + 1).SetFocusElseMsgBox "This Seat/Berth No. is Reserved"NTSeNoText(Index).SetFocusNTSeNoText(Index).Text = ""GoTo cEnd IfElseNTNOPassText(Index + 1).SetFocusEnd IfElseNTNOPassText(Index + 1).SetFocusEnd IfElseNTNOPassText(Index + 1).SetFocusEnd IfElseNTNOPassText(Index + 1).SetFocusEnd Iftn.MoveNextWend

c:tn.Close

30

ElseMsgBox "Please Enter the 1 to 50 Seat No."NTSeNoText(Index).Text = ""End IfEnd IfEnd IfEnd If

Exit Sub

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the only Number"NTSeNoText(Index).Text = ""End Select

End Sub

Private Sub NTSexText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then

If NTSexText(Index).Text <> "" ThenIf NTSexText(Index).Text = "M" Or NTSexText(Index).Text = "F" ThenNTSeMoText(Index).SetFocusElseMsgBox "Please Enter The Only M/F"NTSexText(Index).Text = ""End IfEnd If

End IfEnd Sub

Private Sub NTToAmtlabel_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenNextFr.SetFocusEnd If

End SubPrivate Sub Form_Load()DDate.Caption = Format$(Now, "dd/mmm/yyyy")

conect

Ticket

If tn.EOF = True Or tn.BOF = True ThenNTTNoLabel.Caption = 1Elsetn.MoveLastNTTNoLabel.Caption = tn(1) + 1End If

tn.Close

31

train_info

If ti.EOF = True And ti.BOF = True ThenMsgBox "Not Any Train Exist"ti.CloseExit SubEnd If

ti.MoveFirstNTTrNoCombo.Text = ti(0)NTTrNCombo.Text = ti(1)

While Not ti.EOFNTTrNoCombo.AddItem ti(0)NTTrNCombo.AddItem ti(1)ti.MoveNextWend

ti.Close

End Sub

Private Sub Form_Unload(Cancel As Integer)On Error Resume NextUnload MeEnd Sub

Private Sub NextFr_Click()cn.CloseNTPassINFO.ShowNTPassINFO.NTCatCombo.SetFocusEnd Sub

Private Sub NTClsCombo_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenIf NTClsCombo.Text = "" ThenMsgBox "Plase select The Class"Exit Sub

Else

class

cl.Find "train_no='" & NTTrNoCombo.Text & "'"cl.Find "class='" & NTClsCombo.Text & "'"

If cl.EOF = True Or cl.BOF = True ThenMsgBox "Please select The dragdrop Class"cl.CloseExit SubEnd If

cl.Close

End If

32

End If

If KeyCode = vbKeyReturn ThenNextFr.SetFocusEnd If

End Sub

Private Sub NTDOJouText_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf NTDOJouText.Text = "" ThenMsgBox "Please Enter The Date"ElseOn Error GoTo abcNTDOJouText.Text = Format$(CDate(NTDOJouText.Text), "dd/mmm/yyyy")If KeyCode = vbKeyReturn ThenNTClsCombo.SetFocusEnd IfEnd IfEnd If

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the Correct Date"NTDOJouText.Text = ""End Select

End Sub

Private Sub NTStFrCombo_Click()

train_timestt.Find "train_no='" & NTTrNoCombo.Text & "'"tt.Find "train_station ='" & NTStFrCombo.Text & "'"

NTTOArrLabel.Caption = tt(2)NTTODepLabel.Caption = tt(3)

tt.Close

train_stays

NTStToCombo.Clear

ts.Find "train_no='" & NTTrNoCombo.Text & "'"ts.Find "stays='" & NTStFrCombo.Text & "'"ts.MoveNext

While Not ts.EOFIf ts(0) = NTTrNoCombo.Text ThenNTStToCombo.AddItem ts(1)End Ifts.MoveNext

33

Wend

ts.Close

End Sub

Private Sub NTStFrCombo_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf NTStFrCombo.Text = "" ThenMsgBox "Please Select Station"Exit Sub

Else

train_timestt.Find "train_no='" & NTTrNoCombo.Text & "'"tt.Find "train_station ='" & NTStFrCombo.Text & "'"

If tt.EOF = True Or tt.BOF = True ThenMsgBox "Please select The dragdrop Station"tt.CloseExit SubEnd If

NTTOArrLabel.Caption = tt(2)NTTODepLabel.Caption = tt(3)

tt.Close

End IfEnd If

train_stays

NTStToCombo.Clear

ts.Find "train_no='" & NTTrNoCombo.Text & "'"ts.Find "stays='" & NTStFrCombo.Text & "'"

While Not ts.EOFts.MoveNext

If ts.EOF = True Or ts.BOF = True Thents.CloseIf KeyCode = vbKeyReturn ThenNTStToCombo.SetFocusEnd IfExit SubEnd If

If ts(0) = NTTrNoCombo.Text ThenNTStToCombo.AddItem ts(1)End IfWend

ts.Close

34

If KeyCode = vbKeyReturn ThenNTStToCombo.SetFocusEnd If

End Sub

Private Sub NTStToCombo_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenIf NTStToCombo.Text = "" ThenMsgBox "Please Select Station"Exit Sub

Else

train_timestt.Find "train_no='" & NTTrNoCombo.Text & "'"tt.Find "train_station ='" & NTStToCombo.Text & "'"

If tt.EOF = True Or tt.BOF = True ThenMsgBox "Please select The dragdrop Station"tt.CloseExit SubEnd If

tt.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenNTDOJouText.SetFocusEnd If

End Sub

Private Sub NTTNoCombo_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenNTTrNoCombo.SetFocusEnd If

End Sub

Private Sub NTTrNCombo_Click()train_infoNTTrNoCombo.Text = ""ti.Find "train_name='" & NTTrNCombo.Text & "'"NTTrNoCombo.Text = ti(0)NTDepStOTrLabel.Caption = ti(2)NTDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

35

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"Exit SubEnd If

NTStFrCombo.ClearNTStToCombo.Clear

ts.Find "train_no='" & NTTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = NTTrNoCombo.Text ThenNTStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"End If

NTClsCombo.Clear

cl.Find "train_no='" & NTTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = NTTrNoCombo.Text ThenNTClsCombo.AddItem cl(1)End Ifcl.MoveNextWend

cl.Close

End Sub

Private Sub NTTrNCombo_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf NTTrNCombo.Text = "" ThenMsgBox "Please Select Train"Exit SubElsetrain_infoNTTrNoCombo.Text = ""ti.Find "train_name='" & NTTrNCombo.Text & "'"

If ti.EOF = True Or ti.BOF = True ThenMsgBox "Please select The dragdrop Train Name"ti.CloseExit Sub

36

End If

NTTrNoCombo.Text = ti(0)NTDepStOTrLabel.Caption = ti(2)NTDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

NTStFrCombo.ClearNTStToCombo.Clear

ts.Find "train_no='" & NTTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = NTTrNoCombo.Text ThenNTStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"End If

NTClsCombo.Clear

cl.Find "train_no='" & NTTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = NTTrNoCombo.Text ThenNTClsCombo.AddItem cl(1)End Ifcl.MoveNextWend

cl.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenNTStFrCombo.SetFocusEnd If

End Sub

37

Private Sub NTTrNoCombo_click()

train_infoti.Find "train_no='" & NTTrNoCombo.Text & "'"NTTrNCombo.Text = ti(1)NTDepStOTrLabel.Caption = ti(2)NTDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

NTStFrCombo.ClearNTStToCombo.Clear

ts.Find "train_no='" & NTTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = NTTrNoCombo.Text ThenNTStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"End If

NTClsCombo.Clear

cl.Find "train_no='" & NTTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = NTTrNoCombo.Text ThenNTClsCombo.AddItem cl(1)End Ifcl.MoveNextWend

cl.Close

End Sub

38

Private Sub NTTrNoCombo_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then

If NTTrNoCombo.Text = "" ThenMsgBox "Please Select Train"Elsetrain_infoti.Find "train_no='" & NTTrNoCombo.Text & "'"

If ti.EOF = True Or ti.BOF = True ThenMsgBox "Please select The dragdrop Train No."ti.CloseExit SubEnd If

NTTrNCombo.Text = ti(1)NTDepStOTrLabel.Caption = ti(2)NTDesStOTrLabel.Caption = ti(3)ti.Close

train_stays

If ts.EOF = True And ts.BOF = True ThenMsgBox "No Train Stays Exist"End If

NTStFrCombo.ClearNTStToCombo.Clear

ts.Find "train_no='" & NTTrNoCombo.Text & "'"ts.MoveFirst

While Not ts.EOFIf ts(0) = NTTrNoCombo.Text ThenNTStFrCombo.AddItem ts(1)End Ifts.MoveNextWend

ts.Close

class

If cl.EOF = True And cl.BOF = True ThenMsgBox "No Train Stays Exist"

39

End If

NTClsCombo.Clear

cl.Find "train_no='" & NTTrNoCombo.Text & "'"

While Not cl.EOFIf cl(0) = NTTrNoCombo.Text ThenNTClsCombo.AddItem cl(1)End Ifcl.MoveNextWend

cl.Close

End IfEnd If

If KeyCode = vbKeyReturn ThenNTTrNCombo.SetFocusEnd If

End Sub

Dim rc As New ADODB.Recordset

Private Sub Command1_Click()

Dim Camo, Aamo, Ceamo, Tamo, Namo As IntegerCamo = 0Aamo = 0Ceamo = 0

rc.Open "Select * from save_data where date_of_journey between format('" & CDate(Text1.Text) & "','dd-mmm-yyyy') And format('" & CDate(Text2.Text) & "','dd-mmm-yyyy')", cn, adOpenDynamic, adLockOptimistic, adCmdText

If rc.EOF ThenMsgBox "no records"Exit SubEnd IfWhile Not rc.EOFIf rc!ticket_mode = "Current" ThenCamo = Camo + rc!amountEnd IfIf rc!ticket_mode = "Advance" ThenAamo = Aamo + rc!amount

40

End IfIf rc!ticket_mode = "Cancel" ThenCeamo = Ceamo + rc!amountEnd Ifrc.MoveNextWendLabel9.Caption = CamoLabel10.Caption = AamoLabel11.Caption = Camo + AamoLabel12.Caption = CeamoLabel13.Caption = Label11.Caption - CeamoCommand2.SetFocusrc.Close

End Sub

Private Sub Command2_Click()ROAmu.PrintForm

End Sub

Private Sub Form_Load()

conectEnd Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Text1.Text = "" ThenMsgBox "Please Enter The Date"ElseOn Error GoTo abcText1.Text = Format$(CDate(Text1.Text), "dd/mmm/yyyy")If KeyCode = vbKeyReturn ThenText2.SetFocusEnd IfEnd IfEnd If

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the Correct Date"Text1.Text = ""End SelectEnd Sub

41

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Text2.Text = "" ThenMsgBox "Please Enter The Date"ElseOn Error GoTo abcText2.Text = Format$(CDate(Text2.Text), "dd/mmm/yyyy")If KeyCode = vbKeyReturn ThenCommand1.SetFocusEnd IfEnd IfEnd If

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the Correct Date"Text2.Text = ""End SelectEnd Sub

Dim sqlstmt As String

Private Sub Command1_Click()

conect

Dim rc As New ADODB.Recordset

If Option1(0).Value = True ThenTickets.ShowTickets.DataGrid1.Visible = True

rc.CursorLocation = adUseClientrc.Open "Select * from save_data where date_of_journey between format('" & CDate(Text1.Text) & "','dd-mmm-yyyy') And format('" & CDate(Text2.Text) & "','dd-mmm-yyyy') order by s_no", cn, adOpenStatic, adLockOptimistic, adCmdText

If rc.EOF ThenMsgBox "No Records"Exit SubEnd IfSet Tickets.DataGrid1.DataSource = rcTickets.DataGrid1.ZOrderTickets.Command2.SetFocusEnd If

42

If Option1(1).Value = True ThenTickets.ShowTickets.DataGrid1.Visible = Truerc.CursorLocation = adUseClientrc.Open "Select * from save_data where date_of_journey between format('" & CDate(Text1.Text) & "','dd-mmm-yyyy') And format('" & CDate(Text2.Text) & "','dd-mmm-yyyy') and ticket_mode = 'Current' order by s_no", cn, adOpenStatic, adLockOptimistic, adCmdText

If rc.EOF ThenMsgBox "No Records"Exit SubEnd IfSet Tickets.DataGrid1.DataSource = rcTickets.DataGrid1.RefreshTickets.Command2.SetFocusEnd If

If Option1(2).Value = True ThenTickets.ShowTickets.DataGrid1.Visible = Truerc.CursorLocation = adUseClientrc.Open "Select * from save_data where date_of_journey between format('" & CDate(Text1.Text) & "','dd-mmm-yyyy') And format('" & CDate(Text2.Text) & "','dd-mmm-yyyy') and ticket_mode = 'Advance' order by s_no", cn, adOpenStatic, adLockOptimistic, adCmdText

If rc.EOF ThenMsgBox "No Records"Exit SubEnd IfSet Tickets.DataGrid1.DataSource = rcTickets.DataGrid1.RefreshTickets.Command2.SetFocusEnd If

If Option1(3).Value = True ThenTickets.ShowTickets.DataGrid1.Visible = Truerc.CursorLocation = adUseClientrc.Open "Select * from save_data where date_of_journey between format('" & CDate(Text1.Text) & "','dd-mmm-yyyy') And format('" & CDate(Text2.Text) & "','dd-mmm-yyyy') and ticket_mode = 'Cancel' order by s_no", cn, adOpenStatic, adLockOptimistic, adCmdText

43

If rc.EOF ThenMsgBox "No Records"Exit SubEnd IfSet Tickets.DataGrid1.DataSource = rcTickets.DataGrid1.RefreshTickets.Command2.SetFocusEnd If

End Sub

Private Sub Option1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn ThenIf Option1(Index).Value = True ThenCommand1.SetFocusEnd IfEnd If

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Text1.Text = "" ThenMsgBox "Please Enter The Date"ElseOn Error GoTo abcText1.Text = Format$(CDate(Text1.Text), "dd/mmm/yyyy")If KeyCode = vbKeyReturn ThenText2.SetFocusEnd IfEnd IfEnd If

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the Correct Date"Text1.Text = ""End SelectEnd Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn ThenIf Text2.Text = "" ThenMsgBox "Please Enter The Date"

44

ElseOn Error GoTo abcText2.Text = Format$(CDate(Text2.Text), "dd/mmm/yyyy")If KeyCode = vbKeyReturn ThenOption1(0).SetFocusEnd IfEnd IfEnd If

abc:Select Case Err.NumberCase 13MsgBox "Please Enter the Correct Date"Text2.Text = ""End SelectEnd SubDim i As Integer

Private Sub Form_Load()i = 0Timer1.Enabled = TrueLabel3.Left = 16000Timer7.Enabled = True

End Sub

45

46

47

48

49

50

51

52

53