Sunteți pe pagina 1din 42

CANAL ROAD, JAMMU

ON

UNDER THE GUIDANCE OF SUMANJEET KOUR NO:-09

SUBMITTED BY SHUBAM LANGEH CLASS ROLL BOARD ROLL NO:-

ACKNOWLEDGEMENT
I express my deep sense of gratitude to Sumanjeet Kour, Spring Dales Hr. Sec. School, Jammu. Its a great privilege to have been her student & benefited from her excellent guidance.

Name:- SHUBAM LANGEH Class:- 12th

CERTIFICATE
This is to certify that the project entitled Railway Reservation System present in them has been successfully completed by Shubam Langeh of class XII . In the due fulfillment of requirement for annual session 2011-2012.

Teachers Signature

Principal Signature

CONTENTS
Certificate Acknowledgement Introduction

System Requirements

Introduction to the Visual Basic Coding

Screen Shots

Bibliography

Introduction

A project for automation of a railway reservation system. It facilitatesthe users with a graphical interface for enquiring and reservation. Thesystem has been to be flexible to edit the database of train. Thereservation can be done for the journey from any place regardlessto the place of reservation. It generates a ticket or corresponding status message accordingly. The system must cater to all passenger services provided by Railways and must minimally provide support for reservation of different classes of seats/berths, onward journeys, wait-listed tickets and RAC tickets. Providing support for reservation will also require that the system records information of the various trains running on various routes as well as information about the routes themselves (including the stations and the timings of arrival and departure at/from each station).railway ticketing used the conventional model of preparing standing ticket and selling ticket manually, which resulted in a large labor intensity, low work efficiency, disordered seat management and limited ticketing range.

WORKING ENVIRONMENT
Hardware Environment
Processor RAM HARD DISK Pentium-IV 512 MB RAM 80 GB

Software Environment
OPERATING SYSTEM BACK END FRONTEND Microsoft Windows XP/2000 MS-SQL Server 2000 MS VISUAL BASIC 6.0

INTRODUCTION TO VISUAL BASIC 6.0


In the software development some activities are performed after the main development is complete. Implementation phase is concerned with the actual installation of the software on the computer and then testing it. Two types of specification are required to implement the system; these are software and hardware requirements. System implementation is described in two sections: Firstly, the implementation of the Patient Information System as front end in Visual Basic 6.0 and back end as ORACLE Server. VISUAL BASIC 6.0 DEVELOPMENT SYSTEM Visual Basic is an event driven programming language. Programming in Visual Basic is done visually, which means that as you design your application you will know how your application will look on execution. You can therefore change and experiment with the design to meet your requirement. The main advantage of Visual Basic is that it is Rapid application Development Tool. This is the main reason why Visual Basic is extensively as a prototyping type of language. The predecessor of Visual Basic was BASIC (Beginner All Purpose Symbolic Instruction Code). Basic was mainly interpreter-based language whereas Visual Basic is partly interpreter-based and partly compiler-based. Also Visual Basic supports the OOP but there was no concept of OOP in BASIC. Visual Basic works with all the RDBMS without any problems and provides easy methods for inserting, updating and accessing the data from the database.

CODING Dim ATI As String Dim ATS As String Dim ATT As String Dim ACL As String Private Sub AddAmoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If Index = 4 Then If AddAmoText(Index).Text <> "" Then On Error GoTo abc AddAmoText(Index).Text = CInt(AddAmoText(Index).Text) SaveTrain.SetFocus End If End If If Index < 4 Then If AddAmoText(Index).Text <> "" Then On Error GoTo abc AddAmoText(Index).Text = CInt(AddAmoText(Index).Text) Index = Index + 1 AddStaysText(Index).SetFocus Else SaveTrain.SetFocus End If End If End If Exit Sub abc: Select Case Err.Number Case 13 MsgBox "Please Enter the only Number" AddAmoText(Index).Text = "" End Select End Sub Private Sub AddClassCheck_Click(Index As Integer) If AddClassCheck(Index).Value = 1 Then AddClassMultiAmo(Index).Visible = True AddClassMultiAmo(Index).SetFocus End If 8

End Sub Private Sub AddClassMultiAmo_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddClassMultiAmo(Index).Text = "" Then AddClassMultiAmo(Index).SetFocus Else If Index <= 6 Then On Error GoTo abc AddClassMultiAmo(Index).Text = CInt(AddClassMultiAmo(Index).Text) If Index = 6 Then AddStaysText(0).SetFocus End If Index = Index + 1 If Index <= 6 Then AddClassCheck(Index).SetFocus End If End If End If End If Exit Sub abc: Select Case Err.Number Case 13 MsgBox "Please Enter the only Number" AddClassMultiAmo(Index).Text = "" AddClassMultiAmo(Index).SetFocus End Select End Sub Private Sub AddDepStOTrText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddDepStOTrText = "" Then MsgBox "Please Enter the Departure Station" Else AddDesStOTrText.SetFocus End If End If End Sub Private Sub AddDesStOTrText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then

If AddDesStOTrText = "" Then MsgBox "Please Enter the Destination Station" Else AddClassCheck(0).SetFocus End If End If End Sub Private Sub AddStaysText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddStaysText(0).Text = "" Then AddStaysText(0).SetFocus Else If Index <= 4 Then AddStaysText(Index).SetFocus If AddStaysText(Index).Text <> "" Then AddTOArrText(Index).SetFocus Else SaveTrain.SetFocus End If End If End If End If End Sub Private Sub AddTOArrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddTOArrText(Index).Text = "" Then AddTOArrText(Index).SetFocus Else If AddTOArrText(Index).Text <> "" Then AddTODepText(Index).SetFocus End If End If End If End Sub

10

Private Sub AddTODepText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddTODepText(Index).Text = "" Then AddTODepText(Index).SetFocus Else If AddTODepText(Index).Text <> "" Then AddAmoText(Index).SetFocus End If End If End If End Sub Private Sub AddTrNoText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddTrNoText.Text = "" Then MsgBox "Please Enter the Train No." Else train_info On Error Resume Next ti.MoveFirst While Not ti.EOF If ti(0) = AddTrNoText.Text Then MsgBox "Train No. Is Already Use Another Train" ti.Close AddTrNoText.Text = "" Exit Sub End If ti.MoveNext Wend ti.Close AddTrNText.SetFocus End If End If End Sub Private Sub AddTrNText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If AddTrNText.Text = "" Then MsgBox "Please Enter the Train Name" Else AddDepStOTrText.SetFocus

11

End If End If End Sub Private Sub Form_Load() For Index = 0 To 6 If ATPassINFO.ATNOPassText(Index).Text <> "" Then i=i+1 End If Next class cl.Find "class='" & ATClsLabel.Caption & "'" clss = cl(2) cl.Close train_stays cat.Find "Category='" & ATCatCombo.Text & "'" If ATCatCombo.Text <> "" Then If cat.EOF = True Or cat.BOF = True Then MsgBox "Please Select Any One Category in Drogdrop List" cat.Close Exit Sub End If End If For Index = O To 4 ATQtaLabel(Index).Caption = cat(1) & "%" NextrrLabel ATTODepLabel = ATS.ATTODepLabel ATDOJouLabel = ATS.ATDOJouText ATClsLabel = ATS.ATClsCombo For Index = 0 To 4 ATAmoLabel(Index).Visible = False Next conect category End If Exit Sub

12

Text Then ATNOPassText(Index + 1).SetFocus Else MsgBox "This Seat/Berth No. is Reserved" ATSeNoText(Index).SetFocus ATSeNoText(Index).Text = "" GoTo c End If Else ATNOPassText(Index + 1).SetFocus End If Else ATNOPassText(Index + 1).SetFocus End If Else ATNOPassText(Index + 1).SetFocus End If Else ATNOPassText(Index + 1).SetFocus End If tn.MoveNext Wend c: tn.Close Else MsgBox "Please Enter the 1 to 50 Seat No." ATSeNoText(Index).Text = "" End If End If End If End If Exit Sub abc: Select Case Err.Number Case 13 MsgBox "Please Enter the only Number" ATSeNoText(Index).Text = "" End Select End Sub

13

Private Sub aTSexText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATSexText(Index).Text <> "" Then If ATSexText(Index).Text = "M" Or ATSexText(Index).Text = "F" Then ATSeMoText(Index).SetFocus Else MsgBox "Please Enter The Only M/F" ATSexText(Index).Text = "" End If End If End If End Sub Private Sub aTToAmtText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then Command1.SetFocus End If End Sub Dim sn As Integer Private Sub Exitfr_Click() cn.Close Unload Me Unload ATPassINFO Unload ATS MDIRailway.Show End Sub Private Sub Form_Load() conect Ticket On Error Resume Next tn.MoveLast If tn.EOF = True Or tn.BOF = True Then sn = 1 Else tn.MoveLast

14

sn = tn(0) + 1 End If tn.Close DDate.Caption = ATPassINFO.DDate ATTNoLabel = ATPassINFO.ATTNoLabel ATTrNoLabel = ATPassINFO.ATTrNoLabel ATTrNLabel = ATPassINFO.ATTrNLabel ATDepStOTrLabel = ATPassINFO.ATDepStOTrLabel ATDesStOTrLabel = ATPassINFO.ATDesStOTrLabel ATStFrLabel = ATPassINFO.ATStFrLabel ATStToLabel = ATPassINFO.ATStToLabel ATTOArrLabel = ATPassINFO.ATTOArrLabel ATTODepLabel = ATPassINFO.ATTODepLabel ATDOJouLabel = ATPassINFO.ATDOJouLabel ATClsLabel = ATPassINFO.ATClsLabel ATCatLabel = ATPassINFO.ATCatCombo ATCoTraAuthNoLabel = ATPassINFO.ATCoTraAuthNoText.Text Dim Index As Integer For Index = 0 To 4 If ATPassINFO.ATNOPassText(Index).Text = "" Then ATNOPassLabel(Index).Visible = False ATAgeLabel(Index).Visible = False ATSexLabel(Index).Visible = False ATSeMoLabel(Index).Visible = False ATSeNoLabel(Index).Visible = False ATQtaLabel(Index).Visible = False ATAmoLabel(Index).Visible = False Else SNoLabel(Index).Visible = True ATNOPassLabel(Index).Caption = ATPassINFO.ATNOPassText(Index).Text ATAgeLabel(Index).Caption = ATPassINFO.ATAgeText(Index).Text ATSexLabel(Index).Caption = ATPassINFO.ATSexText(Index).Text ATSeMoLabel(Index).Caption = ATPassINFO.ATSeMoText(Index).Text ATSeNoLabel(Index).Caption = ATPassINFO.ATSeNoText(Index).Text ATQtaLabel(Index).Caption = ATPassINFO.ATQtaLabel(Index).Caption ATAmoLabel(Index).Caption = ATPassINFO.ATAmoLabel(Index).Caption End If Next ATAddLabel.Caption = ATPassINFO.ATAddText ATToAmtLabel.Caption = ATPassINFO.ATToAmtLabel End Sub Private Sub Form_Unload(Cancel As Integer)

15

On Error Resume Next cn.Close End Sub Private Sub SaveData_Click() conect For Index = 0 To 4 If ATNOPassLabel(Index).Visible = True Then s = "insert into save_data values(" & sn s = 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 & "','" 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 + 1 Else Exitfr.SetFocus Exit Sub End If cn.Execute s Next Exitfr.SetFocus End Sub Private Sub ATClscombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATClsCombo.Text = "" Then MsgBox "Plase select The Class" Exit Sub

16

Else class cl.Find "train_no='" & ATTrNoCombo.Text & "'" cl.Find "class='" & ATClsCombo.Text & "'" If cl.EOF = True Or cl.BOF = True Then MsgBox "Please select The dragdrop Class" cl.Close Exit Sub End If cl.Close End If End If If KeyCode = vbKeyReturn Then NextFr.SetFocus End If End Sub Private Sub ATDOJouText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATDOJouText.Text = "" Then MsgBox "Please Enter The Date" Else On Error GoTo abc ATDOJouText.Text = Format$(CDate(ATDOJouText.Text), "dd/mmm/yyyy") If KeyCode = vbKeyReturn Then ATClsCombo.SetFocus End If End If End If abc: Select Case Err.Number Case 13 MsgBox "Please Enter the Correct Date" ATDOJouText.Text = "" End Select End Sub

17

Private Sub ATStFrCombo_Click() train_times tt.Find "train_no='" & ATTrNoCombo.Text & "'" tt.Find "train_station ='" & ATStFrCombo.Text & "'" ATTOArrLabel.Caption = tt(2) ATTODepLabel.Caption = tt(3) tt.Close train_stays ATStToCombo.Clear ts.Find "train_no='" & ATTrNoCombo.Text & "'" ts.Find "stays='" & ATStFrCombo.Text & "'" ts.MoveNext While Not ts.EOF If ts(0) = ATTrNoCombo.Text Then ATStToCombo.AddItem ts(1) End If ts.MoveNext Wend ts.Close End Sub Private Sub ATStFrCombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATStFrCombo.Text = "" Then MsgBox "Please Select Station" Exit Sub Else train_times tt.Find "train_no='" & ATTrNoCombo.Text & "'" tt.Find "train_station ='" & ATStFrCombo.Text & "'" If tt.EOF = True Or tt.BOF = True Then MsgBox "Please select The dragdrop Station" tt.Close Exit Sub

18

End If ATTOArrLabel.Caption = tt(2) ATTODepLabel.Caption = tt(3) tt.Close End If End If train_stays ATStToCombo.Clear ts.Find "train_no='" & ATTrNoCombo.Text & "'" ts.Find "stays='" & ATStFrCombo.Text & "'" While Not ts.EOF ts.MoveNext If ts.EOF = True Or ts.BOF = True Then ts.Close If KeyCode = vbKeyReturn Then ATStToCombo.SetFocus End If Exit Sub End If If ts(0) = ATTrNoCombo.Text Then ATStToCombo.AddItem ts(1) End If Wend ts.Close If KeyCode = vbKeyReturn Then ATStToCombo.SetFocus End If End Sub

Private Sub ATStToCombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATStToCombo.Text = "" Then

19

MsgBox "Please Select Station" Exit Sub Else train_times tt.Find "train_no='" & ATTrNoCombo.Text & "'" tt.Find "train_station ='" & ATStToCombo.Text & "'" If tt.EOF = True Or tt.BOF = True Then MsgBox "Please select The dragdrop Station" tt.Close Exit Sub End If tt.Close End If End If If KeyCode = vbKeyReturn Then ATDOJouText.SetFocus End If End Sub Private Sub ATTNoCombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then ATTrNoCombo.SetFocus End If End Sub Private Sub ATTrNCombo_Click() train_info ti.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 Then MsgBox "No Train Stays Exist"

20

End If ATStFrCombo.Clear ATStToCombo.Clear ts.Find "train_no='" & ATTrNoCombo.Text & "'" ts.MoveFirst While Not ts.EOF If ts(0) = ATTrNoCombo.Text Then ATStFrCombo.AddItem ts(1) End If ts.MoveNext Wend ts.Close class If cl.EOF = True And cl.BOF = True Then MsgBox "No Train Stays Exist" End If ATClsCombo.Clear cl.Find "train_no='" & ATTrNoCombo.Text & "'" While Not cl.EOF If cl(0) = ATTrNoCombo.Text Then ATClsCombo.AddItem cl(1) End If cl.MoveNext Wend cl.Close End Sub Private Sub ATTrNCombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATTrNCombo.Text = "" Then MsgBox "Please Select Train" Exit Sub

21

Else train_info ti.Find "train_name='" & ATTrNCombo.Text & "'" If ti.EOF = True Or ti.BOF = True Then MsgBox "Please select The dragdrop Train Name" ti.Close Exit Sub End 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 Then MsgBox "No Train Stays Exist" End If ATStFrCombo.Clear ATStToCombo.Clear ts.Find "train_no='" & ATTrNoCombo.Text & "'" ts.MoveFirst

While Not ts.EOF If ts(0) = ATTrNoCombo.Text Then ATStFrCombo.AddItem ts(1) End If ts.MoveNext Wend ts.Close class If cl.EOF = True And cl.BOF = True Then MsgBox "No Train Stays Exist" End If ATClsCombo.Clear

22

cl.Find "train_no='" & ATTrNoCombo.Text & "'" While Not cl.EOF If cl(0) = ATTrNoCombo.Text Then ATClsCombo.AddItem cl(1) End If cl.MoveNext Wend cl.Close End If End If If KeyCode = vbKeyReturn Then ATStFrCombo.SetFocus End If End Sub Private Sub ATTrNoCombo_Click() train_info ti.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 Then MsgBox "No Train Stays Exist" End If ATStFrCombo.Clear ATStToCombo.Clear ts.Find "train_no='" & ATTrNoCombo.Text & "'" ts.MoveFirst While Not ts.EOF If ts(0) = ATTrNoCombo.Text Then ATStFrCombo.AddItem ts(1) End If ts.MoveNext

23

Wend ts.Close class If cl.EOF = True And cl.BOF = True Then MsgBox "No Train Stays Exist" End If ATClsCombo.Clear cl.Find "train_no='" & ATTrNoCombo.Text & "'" While Not cl.EOF If cl(0) = ATTrNoCombo.Text Then ATClsCombo.AddItem cl(1) End If cl.MoveNext Wend cl.Close End Sub Private Sub ATTrNoCombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If ATTrNoCombo.Text = "" Then MsgBox "Please Select Train" Exit Sub Else train_info ti.Find "train_no='" & ATTrNoCombo.Text & "'" If ti.EOF = True Or ti.BOF = True Then MsgBox "Please select The dragdrop Train No." ti.Close Exit Sub End If ATTrNCombo.Text = ti(1) ATDepStOTrLabel.Caption = ti(2)

24

End Sub Private Sub mnuadvanceticket_Click() On Error Resume Next Unload Me ATS.Show ATS.ATTrNoCombo.SetFocus End Sub Private Sub mnucurrentticket_Click() On End If End If ts.MoveNext Wend ts.MoveFirst While Not ts.EOF If ts(0) = NTTrNoLabel.Caption Then If ts(1) = NTStToLabel.Caption Then stt = stt + ts(2) End If End If ts.MoveNext Wend ts.Close category cat.MoveFirst cat.Find "category='" & NTCatLabel.Caption & "'" less = cat(1) cat.Close NTNoOPassLabel.Caption = i NTAmoLabel.Caption = ((stt - stf) * clss) * i ap = (stt - stf) * clss NTQtaLabel.Caption = less & "%" NTLessLabel.Caption = NTAmoLabel.Caption * (less / 100) NTNetAmoLabel.Caption = NTAmoLabel.Caption - NTLessLabel.Caption For Index = 0 To 4

25

NTPassINFO.NTAmoLabel(Index).Caption = ap Next End Sub Private Sub NextFr_Click() cn.Close NTPassINFO.Show NTPassINFO.NTToAmtLabel = NTNetAmoLabel Unload Me NTPassINFO.NextFr.SetFocus End Sub Private Sub Form_Load() DDate.Caption = NTS.DDate NTTNoLabel = NTS.NTTNoLabel NTTrNoLabel = NTS.NTTrNoCombo NTTrNLabel = NTS.NTTrNCombo NTDepStOTrLabel = NTS.NTDepStOTrLabel NTDesStOTrLabel = NTS.NTDesStOTrLabel NTStFrLabel = NTS.NTStFrCombo NTStToLabel = NTS.NTStToCombo NTTOArrLabel = NTS.NTTOArrLabel NTTODepLabel = NTS.NTTODepLabel NTDOJouLabel = NTS.NTDOJouText NTClsLabel = NTS.NTClsCombo For Index = 0 To 4 NTAmoLabel(Index).Visible = False Next conect category If cat.EOF = True And cat.BOF = True Then MsgBox "Not Exist Any Catagory" cat.Close Exit Sub End If cat.MoveFirst While Not cat.EOF NTCatCombo.AddItem cat(0)

26

cat.MoveNext Wend cat.Close End Sub Private Sub Form_Unload(Cancel As Integer) On Error Resume Next cn.Close End Sub Private Sub NextFr_Click() On Error Resume Next cn.Close NTPasTicINFO.Show NTPasTicINFO.SaveData.SetFocus Unload Me End Sub Private Sub NTAddText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then NTAmount.Show End If End Sub Private Sub NTAgeText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If NTAgeText(Index).Text <> "" Then On Error GoTo abc NTAgeText(Index).Text = CInt(NTAgeText(Index).Text) If NTCatCombo.Text = "Sr. Citizen" Then If NTAgeText(Index).Text > 65 Then NTSexText(Index).SetFocus Else MsgBox "You are select the Sr. Citizen" NTAgeText(Index).SetFocus NTAgeText(Index).Text = "" Exit Sub End If End If

27

NTSexText(Index).SetFocus Else MsgBox "Please Enter the Age" End If End If Exit Sub abc: Select Case Err.Number Case 13 MsgBox "Please Enter the only Number" NTAgeText(Index).Text = "" End Select End Sub Private Sub NTCatCombo_Click() category cat.Find "Category='" & NTCatCombo.Text & "'" For Index = O To 4 NTQtaLabel(Index).Caption = cat(1) & "%" Next cat.Close End Sub Private Sub NTCatCombo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If NTCatCombo.Text = "" Then MsgBox "Please Select Category" Exit Sub Else category cat.Find "Category='" & NTCatCombo.Text & "'" If NTCatCombo.Text <> "" Then If cat.EOF = True Or cat.BOF = True Then MsgBox "Please Select Any One Category in Drogdrop List" cat.Close Exit Sub End If End If For Index = O To 4 NTQtaLabel(Index).Caption = cat(1) & "%"

28

Next cat.Close End If End If If KeyCode = vbKeyReturn Then If NTCatCombo.Text = "General" Then NTCoTraAuthNoText = "N.A" NTNOPassText(0).SetFocus Else NTCoTraAuthNoText.SetFocus NTCoTraAuthNoText.Text = "" End If End If End Sub Private Sub NTCoTraAuthNoText_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If NTCoTraAuthNoText.Text <> "" Then NTNOPassText(0).SetFocus End If End If End Sub Private Sub NTNOPassText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If NTNOPassText(0).Text = "" Then NTNOPassText(0).SetFocus Else If Index <= 4 Then NTNOPassText(Index).SetFocus If NTNOPassText(Index).Text <> "" Then NTAgeText(Index).SetFocus Else NTAddText.SetFocus End If End If End If End If

29

End Sub Private Sub NTSeMoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If NTSeMoText(Index).Text <> "" Then If NTSeMoText(Index).Text = "Seat" Or NTSeMoText(Index).Text = "Berth" Then NTAmoLabel(Index).Visible = True NTSeNoText(Index).SetFocus Else MsgBox "Please Enter Only Seat/Berth" NTSeMoText(Index).Text = "" End If End If End If End Sub Private Sub NTSeNoText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then If Index = 4 Then If NTSeNoText(Index).Text <> "" Then On Error GoTo abc NTSeNoText(Index).Text = CInt(NTSeNoText(Index).Text) If NTSeNoText(Index).Text <= 50 Then Ticket tn.MoveFirst While Not tn.EOF If tn!train_no = NTTrNoLabel.Caption Then If tn(6) = CDate(NTDOJouLabel.Caption) Then If tn!class = NTClsLabel.Caption Then If tn!seat_mode = NTSeMoText(Index).Text Then If tn!seat_berth_no <> NTSeNoText(Index).Text Then NTAddText.SetFocus Else MsgBox "This Seat/Berth No. is Reserved" NTSeNoText(Index).SetFocus NTSeNoText(Index).Text = "" GoTo a End If Else

30

NTAddText.SetFocus End If Else NTAddText.SetFocus End If Else NTAddText.SetFocus End If Else NTAddText.SetFocus End If tn.MoveNext Wend a: tn.Close Else MsgBox "Please Enter the 1 to 50 Seat No." NTSeNoText(Index).Text = "" End If End If Else If NTSeNoText(Index).Text <> "" Then On Error GoTo abc If NTSeNoText(Index).Text <= 50 Then If Index > 0 And Index <= 4 Then If NTSeMoText(Index - 1).Text = NTSeMoText(Index).Text Then If NTSeNoText(Index - 1).Text = NTSeNoText(Index).Text Then MsgBox "Not Repeat The Seat/Berth No." NTSeNoText(Index).Text = "" Exit Sub End If End If End If Ticket On Error Resume Next tn.MoveFirst If tn.EOF = True And tn.BOF = True Then If tn!train_no = NTTrNoLabel.Caption Then If tn(6) = CDate(NTDOJouLabel.Caption) Then If tn!class = NTClsLabel.Caption Then If tn!seat_mode = NTSeMoText(Index).Text Then

31

If tn!seat_berth_no <> NTSeNoText(Index).Text Then NTNOPassText(Index + 1).SetFocus End If End If End If End If End If End If While Not tn.EOF If tn!train_no = NTTrNoLabel.Caption Then If tn(6) = CDate(NTDOJouLabel.Caption) Then If tn!class = NTClsLabel.Caption Then If tn!seat_mode = NTSeMoText(Index).Text Then If tn!seat_berth_no <> NTSeNoText(Index).Text Then NTNOPassText(Index + 1).SetFocus Else MsgBox "This Seat/Berth No. is Reserved" NTSeNoText(Index).SetFocus NTSeNoText(Index).Text = "" GoTo c End If Else NTNOPassText(Index + 1).SetFocus End If Else NTNOPassText(Index + 1).SetFocus End If Else NTNOPassText(Index + 1).SetFocus End If Else NTNOPassText(Index + 1).SetFocus End If tn.MoveNext Wend c: tn.Close Else MsgBox "Please Enter the 1 to 50 Seat No." NTSeNoText(Index).Text = "" End If End If End If

32

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

33

SCREEN SHOTS

34

35

36

37

38

39

40

41

BIBLIOGRAPHY

S.NO

Name of the Book

Author

1 2 3.

System Analysis and Design MS-Access Mastering Visual Basic 6.0

Awadh R.B Patel Evangelos Petroutsos

42

S-ar putea să vă placă și