Sei sulla pagina 1di 48

Form1

Private Sub Command1_Click()


If Text3.Text = Text1.Text And Text4.Text = Text2.Text Then
Unload Me
MDIForm1.Show
Else
MsgBox ("Invalid Username/Password")
End If
End Sub

Private Sub Command2_Click()


End
End Sub

Private Sub Form_Load()


Text1.Text = y
Text2.Text = z
End Sub
Dim cn1 As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
Dim cn2 As New ADODB.Connection
Dim rs2 As New ADODB.Recordset
Dim cn3 As New ADODB.Connection
Dim rs3 As New ADODB.Recordset
Dim cn4 As New ADODB.Connection
Dim rs4 As New ADODB.Recordset
Dim cn5 As New ADODB.Connection
Dim rs5 As New ADODB.Recordset
Dim cn6 As New ADODB.Connection
Dim rs6 As New ADODB.Recordset

Private Sub Combo7_Click()


s = "select * from seats where train_no = " & Text1.Text & " AND
class = '" & Combo7.Text & "' "
Connect (s)
Set Text66.DataSource = rs
Text66.DataField = "available_seats"
If Text66.Text = "0" Then
MsgBox ("No Seats Available in" & Combo7.Text)
Combo7.Text = ""
End If
End Sub

Private Sub Command1_Click()


If Combo7.Text = "" Then
MsgBox ("Please Select Class")
Exit Sub
End If
If Text11.Text <> "" And Text11.Text <> "0" Then
n1 = Text11.Text
End If
If Text12.Text <> "" And Text12.Text <> "0" Then
n2 = Text12.Text
End If
If Text13.Text <> "" And Text13.Text <> "0" Then
n3 = Text13.Text
End If
If Text14.Text <> "" And Text14.Text <> "0" Then
n4 = Text14.Text
End If
If Text15.Text <> "" And Text15.Text <> "0" Then
n5 = Text15.Text
End If
If Text16.Text <> "" And Text16.Text <> "0" Then
n6 = Text16.Text
End If
Temp2 = Text60.Text
Temp4 = Combo7.Text
Temp6 = Text1.Text
If Text5.Text <> "" And Text11.Text <> "" And Combo1.Text <> ""
Then
If Check1.Value = True Then
Text21.Text = "Yes"
Else
Text21.Text = "No"
End If
Text22.Text = DTPicker1.Value
Text23.Text = Combo7.Text
Text67.Text = Text66.Text
Text66.Text = Text66.Text - 1
rs.Update
rs.MoveNext
rs.MovePrevious
rs1.Update
rs1.MoveNext
rs1.MovePrevious
End If
If Text6.Text <> "" And Text12.Text <> "" And Combo2.Text <> ""
Then
If Check2.Value = True Then
Text28.Text = "Yes"
Else
Text28.Text = "No"
End If
Text29.Text = DTPicker1.Value
Text30.Text = Combo7.Text
Text68.Text = Text66.Text
Text66.Text = Text66.Text - 1
rs.Update
rs.MoveNext
rs.MovePrevious
rs2.Update
rs2.MoveNext
rs2.MovePrevious
End If
If Text7.Text <> "" And Text13.Text <> "" And Combo3.Text <> ""
Then
If Check3.Value = True Then
Text35.Text = "Yes"
Else
Text35.Text = "No"
End If
Text36.Text = DTPicker1.Value
Text37.Text = Combo7.Text
Text69.Text = Text66.Text
Text66.Text = Text66.Text - 1
rs.Update
rs.MoveNext
rs.MovePrevious
rs3.Update
rs3.MoveNext
rs3.MovePrevious
End If
If Text8.Text <> "" And Text14.Text <> "" And Combo4.Text <> ""
Then
If Check4.Value = True Then
Text42.Text = "Yes"
Else
Text42.Text = "No"
End If
Text43.Text = DTPicker1.Value
Text44.Text = Combo7.Text
Adodc2.Refresh
Adodc2.Recordset.MoveLast
Text63.Text = Text59 + 1
Text70.Text = Text66.Text
Text66.Text = Text66.Text - 1
rs.Update
rs.MoveNext
rs.MovePrevious
rs4.Update
rs4.MoveNext
rs4.MovePrevious
End If
If Text9.Text <> "" And Text15.Text <> "" And Combo5.Text <> ""
Then
If Check5.Value = True Then
Text49.Text = "Yes"
Else
Text49.Text = "No"
End If
Text50.Text = DTPicker1.Value
Text51.Text = Combo7.Text
Text71.Text = Text66.Text
Text66.Text = Text66.Text - 1
rs.Update
rs.MoveNext
rs.MovePrevious
rs5.Update
rs5.MoveNext
rs5.MovePrevious
End If
If Text10.Text <> "" And Text16.Text <> "" And Combo6.Text <> ""
Then
If Check6.Value = True Then
Text56.Text = "Yes"
Else
Text56.Text = "No"
End If
Text57.Text = DTPicker1.Value
Text58.Text = Combo7.Text
Text72.Text = Text66.Text
Text66.Text = Text66.Text - 1
rs.Update
rs.MoveNext
rs.MovePrevious
rs6.Update
rs6.MoveNext
rs6.MovePrevious
End If
Unload Me
Load Form3
Form3.Show
End Sub

Private Sub Command3_Click()


rs1.CancelUpdate
rs2.CancelUpdate
rs3.CancelUpdate
rs4.CancelUpdate
rs5.CancelUpdate
rs6.CancelUpdate
Unload Me
End Sub

Private Sub Command4_Click()


Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Combo6.Text = ""
Combo7.Text = ""
Check1.Value = False
Check2.Value = False
Check3.Value = False
Check4.Value = False
Check5.Value = False
Option6.Value = False
End Sub

Private Sub Form_Load()


DTPicker1.Value = Date$
Text1.Text = Temp1
s1 = "select * from reservation"
s2 = "select * from reservation"
s3 = "select * from reservation"
s4 = "select * from reservation"
s5 = "select * from reservation"
s6 = "select * from reservation"
Set cn1 = New ADODB.Connection
cn1.CursorLocation = adUseClient
cn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn1.Open
Set rs1 = New ADODB.Recordset
rs1.CursorType = adOpenDynamic
rs1.LockType = adLockOptimistic
rs1.ActiveConnection = cn1
rs1.Open s1

Set cn2 = New ADODB.Connection


cn2.CursorLocation = adUseClient
cn2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn2.Open
Set rs2 = New ADODB.Recordset
rs2.CursorType = adOpenDynamic
rs2.LockType = adLockOptimistic
rs2.ActiveConnection = cn2
rs2.Open s2

Set cn3 = New ADODB.Connection


cn3.CursorLocation = adUseClient
cn3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn3.Open
Set rs3 = New ADODB.Recordset
rs3.CursorType = adOpenDynamic
rs3.LockType = adLockOptimistic
rs3.ActiveConnection = cn3
rs3.Open s3

Set cn4 = New ADODB.Connection


cn4.CursorLocation = adUseClient
cn4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn4.Open
Set rs4 = New ADODB.Recordset
rs4.CursorType = adOpenDynamic
rs4.LockType = adLockOptimistic
rs4.ActiveConnection = cn4
rs4.Open s4

Set cn5 = New ADODB.Connection


cn5.CursorLocation = adUseClient
cn5.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn5.Open
Set rs5 = New ADODB.Recordset
rs5.CursorType = adOpenDynamic
rs5.LockType = adLockOptimistic
rs5.ActiveConnection = cn5
rs5.Open s5

Set cn6 = New ADODB.Connection


cn6.CursorLocation = adUseClient
cn6.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn6.Open
Set rs6 = New ADODB.Recordset
rs6.CursorType = adOpenDynamic
rs6.LockType = adLockOptimistic
rs6.ActiveConnection = cn6
rs6.Open s6

Set Text5.DataSource = rs1


Text5.DataField = "Passenger_name"
Set Text11.DataSource = rs1
Text11.DataField = "Age"
Set Combo1.DataSource = rs1
Combo1.DataField = "Sex"
Set Text2.DataSource = rs1
Text2.DataField = "Train_No"
Set Text3.DataSource = rs1
Text3.DataField = "Train_Name"
Set Text4.DataSource = rs1
Text4.DataField = "From"
Set Text17.DataSource = rs1
Text17.DataField = "To"
Set Text21.DataSource = rs1
Text21.DataField = "Senior_Citizen"
Set Text22.DataSource = rs1
Text22.DataField = "Date_Travel"
Set Text23.DataSource = rs1
Text23.DataField = "class"
Set Text60.DataSource = rs1
Text60.DataField = "PNR_NO"
Set Text67.DataSource = rs1
Text67.DataField = "Seat_no"

Set Text6.DataSource = rs2


Text6.DataField = "Passenger_name"
Set Text12.DataSource = rs2
Text12.DataField = "Age"
Set Combo2.DataSource = rs2
Combo2.DataField = "Sex"
Set Text24.DataSource = rs2
Text24.DataField = "Train_no"
Set Text25.DataSource = rs2
Text25.DataField = "Train_name"
Set Text26.DataSource = rs2
Text26.DataField = "From"
Set Text27.DataSource = rs2
Text27.DataField = "to"
Set Text28.DataSource = rs2
Text28.DataField = "Senior_Citizen"
Set Text29.DataSource = rs2
Text29.DataField = "Date_Travel"
Set Text30.DataSource = rs2
Text30.DataField = "Class"
Set Text61.DataSource = rs2
Text61.DataField = "PNR_NO"
Set Text68.DataSource = rs2
Text68.DataField = "Seat_no"

Set Text7.DataSource = rs3


Text7.DataField = "Passenger_name"
Set Text13.DataSource = rs3
Text13.DataField = "Age"
Set Combo3.DataSource = rs3
Combo3.DataField = "Sex"
Set Text31.DataSource = rs3
Text31.DataField = "Train_No"
Set Text32.DataSource = rs3
Text32.DataField = "Train_Name"
Set Text33.DataSource = rs3
Text33.DataField = "From"
Set Text34.DataSource = rs3
Text34.DataField = "To"
Set Text35.DataSource = rs3
Text35.DataField = "Senior_Citizen"
Set Text36.DataSource = rs3
Text36.DataField = "Date_Travel"
Set Text37.DataSource = rs3
Text37.DataField = "Class"
Set Text62.DataSource = rs3
Text62.DataField = "PNR_NO"
Set Text69.DataSource = rs3
Text69.DataField = "Seat_no"

Set Text8.DataSource = rs4


Text8.DataField = "Passenger_name"
Set Text14.DataSource = rs4
Text14.DataField = "Age"
Set Combo4.DataSource = rs4
Combo4.DataField = "Sex"
Set Text38.DataSource = rs4
Text38.DataField = "Train_No"
Set Text39.DataSource = rs4
Text39.DataField = "Train_Name"
Set Text40.DataSource = rs4
Text40.DataField = "From"
Set Text41.DataSource = rs4
Text41.DataField = "To"
Set Text42.DataSource = rs4
Text42.DataField = "Senior_Citizen"
Set Text43.DataSource = rs4
Text43.DataField = "Date_Travel"
Set Text44.DataSource = rs4
Text44.DataField = "Class"
Set Text63.DataSource = rs4
Text63.DataField = "PNR_NO"
Set Text70.DataSource = rs4
Text70.DataField = "Seat_no"

Set Text9.DataSource = rs5


Text9.DataField = "Passenger_name"
Set Text15.DataSource = rs5
Text15.DataField = "Age"
Set Combo5.DataSource = rs5
Combo5.DataField = "Sex"
Set Text45.DataSource = rs5
Text45.DataField = "Train_No"
Set Text46.DataSource = rs5
Text46.DataField = "Train_Name"
Set Text47.DataSource = rs5
Text47.DataField = "From"
Set Text48.DataSource = rs5
Text48.DataField = "To"
Set Text49.DataSource = rs5
Text49.DataField = "Senior_Citizen"
Set Text50.DataSource = rs5
Text50.DataField = "Date_Travel"
Set Text51.DataSource = rs5
Text51.DataField = "Class"
Set Text64.DataSource = rs5
Text64.DataField = "PNR_NO"
Set Text71.DataSource = rs5
Text71.DataField = "Seat_no"

Set Text10.DataSource = rs6


Text10.DataField = "Passenger_name"
Set Text16.DataSource = rs6
Text16.DataField = "Age"
Set Combo6.DataSource = rs6
Combo6.DataField = "Sex"
Set Text52.DataSource = rs6
Text52.DataField = "Train_No"
Set Text53.DataSource = rs6
Text53.DataField = "Train_Name"
Set Text54.DataSource = rs6
Text54.DataField = "From"
Set Text55.DataSource = rs6
Text55.DataField = "To"
Set Text56.DataSource = rs6
Text56.DataField = "Senior_Citizen"
Set Text57.DataSource = rs6
Text57.DataField = "Date_Travel"
Set Text58.DataSource = rs6
Text58.DataField = "Class"
Set Text65.DataSource = rs6
Text65.DataField = "PNR_NO"
Set Text72.DataSource = rs6
Text72.DataField = "Seat_no"

rs1.AddNew
rs2.AddNew
rs3.AddNew
rs4.AddNew
rs5.AddNew
rs6.AddNew
Text1.Text = Temp1
Adodc1.Recordset.Find "Train_No =" & Text1.Text, 0,
adSearchForward
Text2.Text = Text1.Text
Text3.Text = Text18.Text
Text4.Text = Text19.Text
Text17.Text = Text20.Text
Text24.Text = Text1.Text
Text25.Text = Text18.Text
Text26.Text = Text19.Text
Text27.Text = Text20.Text
Text31.Text = Text1.Text
Text32.Text = Text18.Text
Text33.Text = Text19.Text
Text34.Text = Text20.Text
Text38.Text = Text1.Text
Text39.Text = Text18.Text
Text40.Text = Text19.Text
Text41.Text = Text20.Text
Text45.Text = Text1.Text
Text46.Text = Text18.Text
Text47.Text = Text19.Text
Text48.Text = Text20.Text
Text52.Text = Text1.Text
Text53.Text = Text18.Text
Text54.Text = Text19.Text
Text55.Text = Text20.Text
Adodc2.Recordset.MoveLast
Text60.Text = Text59 + 1
Text61.Text = Text59 + 1
Text62.Text = Text59 + 1
Text63.Text = Text59 + 1
Text64.Text = Text59 + 1
Text65.Text = Text59 + 1
End Sub

Private Sub check1_Click()


If Text11.Text < 60 Then
MsgBox ("Age Should Be More Than 60")
Check1.Value = False
End If
End Sub

Private Sub check2_Click()


If Text12.Text < 60 Then
MsgBox ("Age Should Be More Than 60")
Check2.Value = False
End If
End Sub

Private Sub check3_Click()


If Text13.Text < 60 Then
MsgBox ("Age Should Be More Than 60")
Check3.Value = False
End If
End Sub

Private Sub check4_Click()


If Text14.Text < 60 Then
MsgBox ("Age Should Be More Than 60")
Check4.Value = False
End If
End Sub

Private Sub check5_Click()


If Text15.Text < 60 Then
MsgBox ("Age Should Be More Than 60")
Check5.Value = False
End If
End Sub

Private Sub Option6_Click()


If Text16.Text < 60 Then
MsgBox ("Age Should Be More Than 60")
Option6.Value = False
End If
End Sub

Private Sub Command1_Click()


Label12.Caption = (Val(Label5.Caption) * Val(Text1.Text)) +
(Val(Label6.Caption) * Val(Text2.Text)) + (Val(Label7.Caption) *
Val(Text3.Text))
End Sub

Private Sub Command2_Click()


temp3 = Label12.Caption
Form5.Label11.Caption = Text1.Text
Form5.Label13.Caption = Text2.Text
Form5.Label15.Caption = Text3.Text
Unload Me
Load Form5
Form5.Show
End Sub

Private Sub Form_Load()


Text4.Text = n1
Text5.Text = n2
Text6.Text = n3
Text7.Text = n4
Text8.Text = n5
Text9.Text = n6
Label10.Caption = Temp4
Label14.Caption = Temp6
Select Case Label14.Caption
Case 1, 3, 5, 7, 9
Select Case Label10.Caption
Case "General"
Label5.Caption = "200"
Label6.Caption = "100"
Label7.Caption = "150"
Case "II Class"
Label5.Caption = "350"
Label6.Caption = "200"
Label7.Caption = "300"
Case "II sitting"
Label5.Caption = "220"
Label6.Caption = "120"
Label7.Caption = "200"
Case "II sleeper"
Label5.Caption = "400"
Label6.Caption = "250"
Label7.Caption = "350"
Case "I Class"
Label5.Caption = "560"
Label6.Caption = "300"
Label7.Caption = "500"
Case "III tier AC"
Label5.Caption = "750"
Label6.Caption = "450"
Label7.Caption = "600"
Case "II Tier AC"
Label5.Caption = "1150"
Label6.Caption = "650"
Label7.Caption = "800"
Case "I AC"
Label5.Caption = "2750"
Label6.Caption = "1500"
Label7.Caption = "2000"
End Select
Case 2, 4, 6, 8
Select Case Label10.Caption
Case "General"
Label5.Caption = "175"
Label6.Caption = "75"
Label7.Caption = "150"
Case "II Class"
Label5.Caption = "330"
Label6.Caption = "190"
Label7.Caption = "290"
Case "II sitting"
Label5.Caption = "200"
Label6.Caption = "100"
Label7.Caption = "150"
Case "II sleeper"
Label5.Caption = "375"
Label6.Caption = "240"
Label7.Caption = "330"
Case "I Class"
Label5.Caption = "550"
Label6.Caption = "300"
Label7.Caption = "475"
Case "III tier AC"
Label5.Caption = "730"
Label6.Caption = "450"
Label7.Caption = "580"
Case "II Tier AC"
Label5.Caption = "1100"
Label6.Caption = "625"
Label7.Caption = "775"
Case "I AC"
Label5.Caption = "2500"
Label6.Caption = "1300"
Label7.Caption = "1975"
End Select
End Select
End Sub

Private Sub Text10_Change()


If Val(Text10.Text) > 0 And Val(Text10.Text) < 18 Then
Text2.Text = Text2.Text + 1
ElseIf Val(Text10.Text) > 18 And Val(Text10.Text) < 60 Then
Text1.Text = Text1.Text + 1
ElseIf Val(Text10.Text) > 60 Then
Text3.Text = Text3.Text + 1
End If
End Sub

Private Sub Text11_Change()


If Val(Text11.Text) > 0 And Val(Text11.Text) < 18 Then
Text2.Text = Text2.Text + 1
ElseIf Val(Text11.Text) > 18 And Val(Text11.Text) < 60 Then
Text1.Text = Text1.Text + 1
ElseIf Val(Text11.Text) > 60 Then
Text3.Text = Text3.Text + 1
End If
End Sub

Private Sub Text12_Change()


If Val(Text12.Text) > 0 And Val(Text12.Text) < 18 Then
Text2.Text = Text2.Text + 1
ElseIf Val(Text12.Text) > 18 And Val(Text12.Text) < 60 Then
Text1.Text = Text1.Text + 1
ElseIf Val(Text12.Text) > 60 Then
Text3.Text = Text3.Text + 1
End If
End Sub

Private Sub Text13_Change()


If Val(Text13.Text) > 0 And Val(Text13.Text) < 18 Then
Text2.Text = Text2.Text + 1
ElseIf Val(Text13.Text) > 18 And Val(Text13.Text) < 60 Then
Text1.Text = Text1.Text + 1
ElseIf Val(Text13.Text) > 60 Then
Text3.Text = Text3.Text + 1
End If

End Sub

Private Sub Text14_Change()


If Val(Text14.Text) > 0 And Val(Text14.Text) < 18 Then
Text2.Text = Text2.Text + 1
ElseIf Val(Text14.Text) > 18 And Val(Text14.Text) < 60 Then
Text1.Text = Text1.Text + 1
ElseIf Val(Text14.Text) > 60 Then
Text3.Text = Text3.Text + 1
End If
End Sub

Private Sub Text15_Change()


If Val(Text15.Text) > 0 And Val(Text15.Text) < 18 Then
Text2.Text = Text2.Text + 1
ElseIf Val(Text15.Text) > 18 And Val(Text15.Text) < 60 Then
Text1.Text = Text1.Text + 1
ElseIf Val(Text15.Text) > 60 Then
Text3.Text = Text3.Text + 1
End If
End Sub

Private Sub Text4_Change()


If Text4.Text <> "" And Text4.Text <> "0" Then
Text10.Text = Text4.Text
End If
End Sub

Private Sub Text5_Change()


If Text5.Text <> "" And Text5.Text <> "0" Then
Text11.Text = Text5.Text
End If
End Sub

Private Sub Text6_Change()


If Text6.Text <> "" And Text6.Text <> "0" Then
Text12.Text = Text6.Text
End If
End Sub

Private Sub Text7_Change()


If Text7.Text <> "" And Text7.Text <> "0" Then
Text13.Text = Text7.Text
End If
End Sub

Private Sub Text8_Change()


If Text8.Text <> "" And Text8.Text <> "0" Then
Text14.Text = Text8.Text
End If
End Sub

Private Sub Text9_Change()


If Text9.Text <> "" And Text9.Text <> "0" Then
Text15.Text = Text9.Text
End If
End Sub

Private Sub Combo1_Click()


Adodc1.Refresh
Adodc1.Recordset.Find "Train_No =" & Combo1.Text, 0,
adSearchForward
If Adodc1.Recordset.EOF = True Then
MsgBox ("Train not Available")
End If
End Sub

Private Sub Command1_Click()


Temp1 = Combo1.Text
Unload Me
Load Form2
Form2.Show
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Dim rs1 As New ADODB.Recordset


Dim cn1 As New ADODB.Connection
Private Sub Command1_Click()
Command1.Visible = False
Dim Beginpage, EndPage, NumCopies, orientation, i
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.ShowPrinter
Beginpage = CommonDialog1.FromPage
EndPage = CommonDialog1.ToPage
NumCopies = CommonDialog1.Copies
orientation = CommonDialog1.orientation
For i = 1 To NumCopies
Form5.PrintForm
Next
Exit Sub
ErrHandler:
Exit Sub
End Sub

Private Sub Form_Load()


Label9.Caption = "Rs." & "" & temp3
Text3.Text = Temp2
s = " select * from reservation where PNR_NO = " & Text3.Text & " "
Connect (s)
Set Text1.DataSource = rs
Text1.DataField = "Train_No"
Set Text2.DataSource = rs
Text2.DataField = "Date_travel"
Set Text3.DataSource = rs
Text3.DataField = "PNR_NO"
Set Text4.DataSource = rs
Text4.DataField = "Class"
Set Text18.DataSource = rs
Text18.DataField = "Train_Name"
Set Text19.DataSource = rs
Text19.DataField = "From"
Set Text20.DataSource = rs
Text20.DataField = "To"
Set Label22.DataSource = rs
Label22.DataField = "date_travel"
Set DataGrid1.DataSource = rs
SQL = "select * from timings where train_no = " & Text1.Text & ""
Set cn1 = New ADODB.Connection
cn1.CursorLocation = adUseClient
cn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn1.Open
Set rs1 = New ADODB.Recordset
rs1.CursorType = adOpenDynamic
rs1.LockType = adLockOptimistic
rs1.ActiveConnection = cn1
rs1.Open SQL
Set Label17.DataSource = rs1
Label17.DataField = "Distance"
Set Label20.DataSource = rs1
Label20.DataField = "Arrival_Time"
Set Label24.DataSource = rs1
Label24.DataField = "departure_time"

End Sub

Private Sub Command1_Click()


Unload Me
End Sub

Private Sub Command2_Click()


If MsgBox(" Are you sure you want to cancel this ticket?", vbYesNo,
"RRS") = vbYes Then
s1 = "delete from reservation where PNR_NO = " & Text1.Text & " "
Connect (s1)
Temp5 = Text1.Text
n7 = Text2.Text
Unload Me
Load Form7
Form7.Show
End If
End Sub
Private Sub Text1_Change()
s = "select * from reservation where PNR_NO = " & Text1.Text & " "
Connect (s)
Set DataGrid1.DataSource = rs
Text2.Text = rs.RecordCount
End Sub

Private Sub Command1_Click()


Command1.Visible = False
Dim Beginpage, EndPage, NumCopies, orientation, i
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.ShowPrinter
Beginpage = CommonDialog1.FromPage
EndPage = CommonDialog1.ToPage
NumCopies = CommonDialog1.Copies
orientation = CommonDialog1.orientation
For i = 1 To NumCopies
Form7.PrintForm
Next
Exit Sub
ErrHandler:
Exit Sub
End Sub

Private Sub Form_Load()


Text6.Text = n7
Text3.Text = Temp5
Text5.Text = Temp5
End Sub

Private Sub Text6_Change()


Label9.Caption = "Rs." & Val(Text6.Text) * 20
End Sub
Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()


s = "select * from reservation where date_travel = ' " + Combo1.Text
+"'"
Connect (s)
Set DataGrid1.DataSource = rs
End Sub

Private Sub Command1_Click()


Unload Me
End Sub
Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command1_Click()


Unload Me
End Sub
Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command1_Click()


If Text1.Text <> "" And Combo7.Text <> "" Then
Label14.Caption = Text1.Text
Label10.Caption = Combo7.Text
s = "select * from fares where train_no = " & Label14.Caption & " "
Connect (s)
Set Label2.DataSource = rs
Label2.DataField = "train_name"
Select Case Label14.Caption
Case "1", "3", "5", "7", "9"
Select Case Label10.Caption
Case "General"
Label5.Caption = "200"
Label6.Caption = "100"
Label7.Caption = "150"
Case "II class"
Label5.Caption = "350"
Label6.Caption = "200"
Label7.Caption = "300"
Case "II sitting"
Label5.Caption = "220"
Label6.Caption = "120"
Label7.Caption = "200"
Case "II sleeper"
Label5.Caption = "400"
Label6.Caption = "250"
Label7.Caption = "350"
Case "I class"
Label5.Caption = "560"
Label6.Caption = "300"
Label7.Caption = "500"
Case "III tier AC"
Label5.Caption = "750"
Label6.Caption = "450"
Label7.Caption = "600"
Case "II Tier AC"
Label5.Caption = "1150"
Label6.Caption = "650"
Label7.Caption = "800"
Case "I AC"
Label5.Caption = "2750"
Label6.Caption = "1500"
Label7.Caption = "2000"
End Select
Case "2", "4", "6", "8"
Select Case Label10.Caption
Case "General"
Label5.Caption = "175"
Label6.Caption = "75"
Label7.Caption = "150"
Case "II class"
Label5.Caption = "330"
Label6.Caption = "190"
Label7.Caption = "290"
Case "II sitting"
Label5.Caption = "200"
Label6.Caption = "100"
Label7.Caption = "150"
Case "II sleeper"
Label5.Caption = "375"
Label6.Caption = "240"
Label7.Caption = "330"
Case "I class"
Label5.Caption = "550"
Label6.Caption = "300"
Label7.Caption = "475"
Case "III tier AC"
Label5.Caption = "730"
Label6.Caption = "450"
Label7.Caption = "580"
Case "II Tier AC"
Label5.Caption = "1100"
Label6.Caption = "625"
Label7.Caption = "775"
Case "I AC"
Label5.Caption = "2500"
Label6.Caption = "1300"
Label7.Caption = "1975"
End Select
End Select
Else
MsgBox ("Please do not leave any field blank")
End If
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub cmdOK_Click()


Unload Me
End Sub
Private Sub Form_Load()
Timer1.Interval = 50
End Sub

Private Sub Timer1_Timer()


ProgressBar1.Value = ProgressBar1.Value + 1
Select Case ProgressBar1.Value
Case "10"
Label1.Caption = "loading..."
Case "35"
Label1.Caption = "opening database..."
Case "65"
Label1.Caption = "checking connectivity..."
Case "90"
Label1.Caption = "welcome to RRS"
Case "100"
Unload Me
Form1.Show
End Select
y = "gopal"
z = "krishna"
End Sub

Private Sub Command1_Click()


Form12.Show
End Sub

Private Sub mnuAbt_Click()


frmAbout.Show
End Sub

Private Sub mnuCan_Click()


Form6.Show
End Sub

Private Sub mnuCascade_Click()


MDIForm1.Arrange vbCascade
End Sub

Private Sub mnuFD_Click()


Form13.Show
End Sub

Private Sub mnuFL_Click()


Form11.Show
End Sub

Private Sub mnuRepRes_Click()


Form8.Show
End Sub

Private Sub mnuRes_Click()


Form4.Show
End Sub

Private Sub mnuSearch_Click()


Form4.Show
End Sub

Private Sub mnuSL_Click()


Form10.Show
End Sub

Private Sub mnuTH_Click()


MDIForm1.Arrange vbTileHorizontal
End Sub

Private Sub mnuTL_Click()


Form9.Show
End Sub

Private Sub mnuTV_Click()


MDIForm1.Arrange vbTileVertical
End Sub

Private Sub mnuxit_Click()


If MsgBox("Are you sure you want to exit?", vbYesNo, "RRS") = vbYes
Then
End
End If
End Sub

Private Sub Timer1_Timer()


Label3.Caption = Date
Label4.Caption = Time
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)


Select Case Button.Caption
Case "Search"
Form4.Show
Form4.Command1.Visible = False
Form4.Command2.Visible = True
Form4.Label1.Caption = "Search Train"
Case "Reservation"
Form4.Show
Form4.Caption = "Select Train Number"
Form4.Command2.Visible = False
Case "Cancellation"
Form6.Show
Case "Exit"
If MsgBox("Are you sure you want to exit?", vbYesNo, "RRS") = vbYes
Then
End
End If
Case "About"
frmAbout.Show
End Select
End Sub

// module 1 .bas
Public rs As New ADODB.Recordset
Public cn As New ADODB.Connection
Public Temp1 As String
Public Temp2 As String
Public temp3 As String
Public Temp4 As String
Public Temp5 As String
Public Temp6 As String
Public y As String
Public z As String
Public n1, n2, n3, n4, n5, n6, n7 As Integer

Public Function connect(ByVal SQL As String) As String


Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Railway\Railway Reservation.mdb;Persist Security
Info=False"
cn.Open
Set rs = New ADODB.Recordset
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.ActiveConnection = cn
rs.Open SQL
End Function
Private Sub Command1_Click()
Form12.Show
End Sub

Private Sub mnuAbt_Click()


frmAbout.Show
End Sub

Private Sub mnuCan_Click()


Form6.Show
End Sub

Private Sub mnuCascade_Click()


MDIForm1.Arrange vbCascade
End Sub

Private Sub mnuFD_Click()


Form13.Show
End Sub
Private Sub mnuFL_Click()
Form11.Show
End Sub

Private Sub mnuRepRes_Click()


Form8.Show
End Sub

Private Sub mnuRes_Click()


Form4.Show
End Sub

Private Sub mnuSearch_Click()


Form4.Show
End Sub

Private Sub mnuSL_Click()


Form10.Show
End Sub

Private Sub mnuTH_Click()


MDIForm1.Arrange vbTileHorizontal
End Sub

Private Sub mnuTL_Click()


Form9.Show
End Sub

Private Sub mnuTV_Click()


MDIForm1.Arrange vbTileVertical
End Sub

Private Sub mnuxit_Click()


If MsgBox("Are you sure you want to exit?", vbYesNo, "RRS") = vbYes
Then
End
End If
End Sub

Private Sub Timer1_Timer()


Label3.Caption = Date
Label4.Caption = Time
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)


Select Case Button.Caption
Case "Search"
Form4.Show
Form4.Command1.Visible = False
Form4.Command2.Visible = True
Form4.Label1.Caption = "Search Train"
Case "Reservation"
Form4.Show
Form4.Caption = "Select Train Number"
Form4.Command2.Visible = False
Case "Cancellation"
Form6.Show
Case "Exit"
If MsgBox("Are you sure you want to exit?", vbYesNo, "RRS") = vbYes
Then
End
End If
Case "About"
frmAbout.Show
End Select
End Sub
fares
Train_No Train_Name Class Adult Child Senior_Citizen
1 HOWRAH-AMRITSAR EXPRESS I Class 560 300 500
1 HOWRAH-AMRITSAR EXPRESS II Class 350 200 300
1 HOWRAH-AMRITSAR EXPRESS General 200 100 150
1 HOWRAH-AMRITSAR EXPRESS II Sitting 220 120 200
1 HOWRAH-AMRITSAR EXPRESS II Sleeper 400 250 350
1 HOWRAH-AMRITSAR EXPRESS III Tier AC 750 450 600
1 HOWRAH-AMRITSAR EXPRESS II Tier AC 1150 650 800
1 HOWRAH-AMRITSAR EXPRESS I AC 2750 1500 2000
2 MALDA BHIWANI EXPRESS I Class 550 300 475
2 MALDA BHIWANI EXPRESS II Class 330 190 290
2 MALDA BHIWANI EXPRESS General 175 75 150
2 MALDA BHIWANI EXPRESS II Sitting 200 100 150
2 MALDA BHIWANI EXPRESS II Sleeper 375 240 330
2 MALDA BHIWANI EXPRESS III Tier AC 730 450 580
2 MALDA BHIWANI EXPRESS II Tier AC 1100 625 775
2 MALDA BHIWANI EXPRESS I AC 2500 1300 1975
3 ALLAHABAD-FAIZABAD EXPRESS I Class 560 300 500
3 ALLAHABAD-FAIZABAD EXPRESS II Class 350 200 300
3 ALLAHABAD-FAIZABAD EXPRESS General 200 100 150
3 ALLAHABAD-FAIZABAD EXPRESS II Sitting 220 120 200
3 ALLAHABAD-FAIZABAD EXPRESS II Sleeper 400 250 350
3 ALLAHABAD-FAIZABAD EXPRESS III Tier AC 750 450 600
3 ALLAHABAD-FAIZABAD EXPRESS II Tier AC 1150 650 800
3 ALLAHABAD-FAIZABAD EXPRESS I AC 2750 1500 2000
4 HOWRAH-JAMMUTAWAI EXPRESS I Class 550 300 475
4 HOWRAH-JAMMUTAWAI EXPRESS II Class 330 190 290
4 HOWRAH-JAMMUTAWAI EXPRESS General 175 75 150
4 HOWRAH-JAMMUTAWAI EXPRESS II Sitting 200 100 150
4 HOWRAH-JAMMUTAWAI EXPRESS II Sleeper 375 240 330
fares
Train_No Train_Name Class Adult Child Senior_Citizen
4 HOWRAH-JAMMUTAWAI EXPRESS III Tier AC 730 450 580
4 HOWRAH-JAMMUTAWAI EXPRESS II Tier AC 1100 625 775
4 HOWRAH-JAMMUTAWAI EXPRESS I AC 2500 1300 1975
5 VARANASI-LUCKNOW EXPRESS I Class 560 300 500
5 VARANASI-LUCKNOW EXPRESS II Class 350 200 300
5 VARANASI-LUCKNOW EXPRESS General 200 100 150
5 VARANASI-LUCKNOW EXPRESS II Sitting 220 120 200
5 VARANASI-LUCKNOW EXPRESS II Sleeper 400 250 350
5 VARANASI-LUCKNOW EXPRESS III Tier AC 750 450 600
5 VARANASI-LUCKNOW EXPRESS II Tier AC 1150 650 800
5 VARANASI-LUCKNOW EXPRESS I AC 2750 1500 2000
6 BOMBAY-FAIZABD SAKET EXPRESS I Class 550 300 475
6 BOMBAY-FAIZABD SAKET EXPRESS II Class 330 190 290
6 BOMBAY-FAIZABD SAKET EXPRESS General 175 75 150
6 BOMBAY-FAIZABD SAKET EXPRESS II Sitting 200 100 150
6 BOMBAY-FAIZABD SAKET EXPRESS II Sleeper 375 240 330
6 BOMBAY-FAIZABD SAKET EXPRESS III Tier AC 730 450 580
6 BOMBAY-FAIZABD SAKET EXPRESS II Tier AC 1100 625 775
6 BOMBAY-FAIZABD SAKET EXPRESS I AC 2500 1300 1975
7 PATNA-NEW DELHI EXPRESS I Class 560 300 500
7 PATNA-NEW DELHI EXPRESS II Class 350 200 300
7 PATNA-NEW DELHI EXPRESS General 200 100 150
7 PATNA-NEW DELHI EXPRESS II Sitting 220 120 200
7 PATNA-NEW DELHI EXPRESS II Sleeper 400 250 350
7 PATNA-NEW DELHI EXPRESS III Tier AC 750 450 600
7 PATNA-NEW DELHI EXPRESS II Tier AC 1150 650 800
7 PATNA-NEW DELHI EXPRESS I AC 2750 1500 2000
8 MUZZAFFARPUR NEW DELHI EXPRESS I Class 550 300 475
8 MUZZAFFARPUR NEW DELHI EXPRESS II Class 330 190 290
8 MUZZAFFARPUR NEW DELHI EXPRESS General 175 75 150
8 MUZZAFFARPUR NEW DELHI EXPRESS II Sitting 200 100 150
8 MUZZAFFARPUR NEW DELHI EXPRESS II Sleeper 375 240 330
8 MUZZAFFARPUR NEW DELHI EXPRESS III Tier AC 730 450 580
8 MUZZAFFARPUR NEW DELHI EXPRESS II Tier AC 1100 625 775
8 MUZZAFFARPUR NEW DELHI EXPRESS I AC 2500 1300 1975
9 SULTANPUR-NEW DELHI EXPRESS I Class 560 300 500
9 SULTANPUR-NEW DELHI EXPRESS II Class 350 200 300
9 SULTANPUR-NEW DELHI EXPRESS General 200 100 150
9 SULTANPUR-NEW DELHI EXPRESS II Sitting 220 120 200
9 SULTANPUR-NEW DELHI EXPRESS II Sleeper 400 250 350
fares
Train_No Train_Name Class Adult Child Senior_Citizen
9 SULTANPUR-NEW DELHI EXPRESS III Tier AC 750 450 600
9 SULTANPUR-NEW DELHI EXPRESS II Tier AC 1150 650 800
9 SULTANPUR-NEW DELHI EXPRESS I AC 2750 1500 2000

Reservation
PNR_N Train_ Train_Na Date_Tr Passenger_ Ag Se Senior_Cit Seat_
From To Class
O No me avel Name e x izen No
12345 1 HOWRAH- HOWR AMRITSAR 26-12- II Sukanya 17 F No 72
678 AMRITSAR AH 2009 Sleep
EXPRESS er
12345 4 HOWRAH- HOWR JAMMUTA 26-12- II Anannya 12 F No 72
679 JAMMUTA AH WAI 2009 sleep
WAI er
EXPRESS
12345 1 HOWRAH- HOWR AMRITSAR 26-12- II Mr. Sahani 51 M No 71
680 AMRITSAR AH 2009 sleep
EXPRESS er
12345 1 HOWRAH- HOWR AMRITSAR 26-12- II Mrs. Sahani 43 F No 69
680 AMRITSAR AH 2009 sleep
EXPRESS er

Seats
Train_No Train_Name Class Available_Seats
1 HOWRAH-AMRITSAR EXPRESS I Class 36
1 HOWRAH-AMRITSAR EXPRESS II Class 144
1 HOWRAH-AMRITSAR EXPRESS General Class 81
1 HOWRAH-AMRITSAR EXPRESS II Sitting 144
1 HOWRAH-AMRITSAR EXPRESS II Sleeper 68
1 HOWRAH-AMRITSAR EXPRESS III Tier AC 72
1 HOWRAH-AMRITSAR EXPRESS II Tier AC 54
1 HOWRAH-AMRITSAR EXPRESS I AC 20
2 MALDA BHIWANI EXPRESS I Class 36
2 MALDA BHIWANI EXPRESS II Class 144
2 MALDA BHIWANI EXPRESS General Class 81
2 MALDA BHIWANI EXPRESS II Sitting 144
2 MALDA BHIWANI EXPRESS II Sleeper 72
2 MALDA BHIWANI EXPRESS III Tier AC 72
2 MALDA BHIWANI EXPRESS II Tier AC 54
2 MALDA BHIWANI EXPRESS I AC 20
3 ALLAHABAD-FAIZABAD EXPRESS I Class 36
Seats
Train_No Train_Name Class Available_Seats
3 ALLAHABAD-FAIZABAD EXPRESS II Class 144
3 ALLAHABAD-FAIZABAD EXPRESS General Class 81
3 ALLAHABAD-FAIZABAD EXPRESS II Sitting 144
3 ALLAHABAD-FAIZABAD EXPRESS II Sleeper 72
3 ALLAHABAD-FAIZABAD EXPRESS III Tier AC 72
3 ALLAHABAD-FAIZABAD EXPRESS II Tier AC 54
3 ALLAHABAD-FAIZABAD EXPRESS I AC 20
4 HOWRAH-JAMMUTAWAI EXPRESS I Class 36
4 HOWRAH-JAMMUTAWAI EXPRESS II Class 144
4 HOWRAH-JAMMUTAWAI EXPRESS General Class 81
4 HOWRAH-JAMMUTAWAI EXPRESS II Sitting 144
4 HOWRAH-JAMMUTAWAI EXPRESS II Sleeper 71
4 HOWRAH-JAMMUTAWAI EXPRESS III Tier AC 72
4 HOWRAH-JAMMUTAWAI EXPRESS II Tier AC 54
4 HOWRAH-JAMMUTAWAI EXPRESS I AC 20
5 VARANASI-LUCKNOW EXPRESS I Class 36
5 VARANASI-LUCKNOW EXPRESS II Class 144
5 VARANASI-LUCKNOW EXPRESS General Class 81
5 VARANASI-LUCKNOW EXPRESS II Sitting 144
5 VARANASI-LUCKNOW EXPRESS II Sleeper 72
5 VARANASI-LUCKNOW EXPRESS III Tier AC 72
5 VARANASI-LUCKNOW EXPRESS II Tier AC 54
5 VARANASI-LUCKNOW EXPRESS I AC 20
6 BOMBAY-FAIZABD SAKET EXPRESS I Class 36
6 BOMBAY-FAIZABD SAKET EXPRESS II Class 144
6 BOMBAY-FAIZABD SAKET EXPRESS General Class 81
6 BOMBAY-FAIZABD SAKET EXPRESS II Sitting 144
6 BOMBAY-FAIZABD SAKET EXPRESS II Sleeper 72
6 BOMBAY-FAIZABD SAKET EXPRESS III Tier AC 72
6 BOMBAY-FAIZABD SAKET EXPRESS II Tier AC 54
6 BOMBAY-FAIZABD SAKET EXPRESS I AC 20
7 PATNA-NEW DELHI EXPRESS I Class 36
7 PATNA-NEW DELHI EXPRESS II Class 144
7 PATNA-NEW DELHI EXPRESS General Class 81
7 PATNA-NEW DELHI EXPRESS II Sitting 144
7 PATNA-NEW DELHI EXPRESS II Sleeper 72
7 PATNA-NEW DELHI EXPRESS III Tier AC 72
7 PATNA-NEW DELHI EXPRESS II Tier AC 54
7 PATNA-NEW DELHI EXPRESS I AC 20
8 MUZZAFFARPUR NEW DELHI EXPRESS I Class 36
Seats
Train_No Train_Name Class Available_Seats
8 MUZZAFFARPUR NEW DELHI EXPRESS II Class 144
8 MUZZAFFARPUR NEW DELHI EXPRESS General Class 81
8 MUZZAFFARPUR NEW DELHI EXPRESS II Sitting 144
8 MUZZAFFARPUR NEW DELHI EXPRESS II Sleeper 72
8 MUZZAFFARPUR NEW DELHI EXPRESS III Tier AC 72
8 MUZZAFFARPUR NEW DELHI EXPRESS II Tier AC 54
8 MUZZAFFARPUR NEW DELHI EXPRESS I AC 20
9 SULTANPUR-NEW DELHI EXPRESS I Class 36
9 SULTANPUR-NEW DELHI EXPRESS II Class 144
9 SULTANPUR-NEW DELHI EXPRESS General Class 81
9 SULTANPUR-NEW DELHI EXPRESS II Sitting 144
9 SULTANPUR-NEW DELHI EXPRESS II Sleeper 72
9 SULTANPUR-NEW DELHI EXPRESS III Tier AC 72
9 SULTANPUR-NEW DELHI EXPRESS II Tier AC 54
9 SULTANPUR-NEW DELHI EXPRESS I AC 20

timings
Train_No Distance Arrival_Time Departure_Time
1 123 09:05 09:15
2 345 10:15 10:25
3 567 11:25 11:35
4 789 12:35 12:45
5 890 13:45 13:55
6 901 14:55 15:05
7 135 16:05 16:15
8 246 17:15 17:25
9 357 18:25 18:35

Trains
Train_No Train_Name From To OP_Basis
1 HOWRAH-AMRITSAR EXPRESS HOWRAH AMRITSAR Daily
2 MALDA BHIWANI EXPRESS MALDA BHIWANI Daily
3 ALLAHABAD-FAIZABAD EXPRESS ALLAHABAD FAIZABAD Daily
4 HOWRAH-JAMMUTAWAI EXPRESS HOWRAH JAMMUTAWAI Daily
5 VARANASI-LUCKNOW EXPRESS VARANASI LUCKNOW Daily
6 BOMBAY-FAIZABD SAKET EXPRESS MUMBAI FAIZABAD Daily
7 PATNA-NEW DELHI EXPRESS PATNA NEW DELHI Daily
Trains
Train_No Train_Name From To OP_Basis
8 MUZZAFFARPUR NEW DELHI EXPRESS MUZZAFFARPUR NEW DELHI Daily
9 SULTANPUR-NEW DELHI EXPRESS SULTANPUR NEW DELHI Daily

Potrebbero piacerti anche