📄 p_booking_information.frm
字号:
Height = 420
Left = 600
TabIndex = 18
Top = 4200
Width = 2175
End
Begin VB.Label Label9
BackColor = &H00FFC0C0&
Caption = " Ending Place"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 16
Top = 3840
Width = 2175
End
Begin VB.Label Label8
BackColor = &H00FFC0C0&
Caption = " Starting Place"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 14
Top = 3480
Width = 2175
End
Begin VB.Image Image4
Height = 315
Left = 5520
Picture = "p_booking_information.frx":146D03
Top = 3120
Width = 300
End
Begin VB.Label Label7
BackColor = &H00FFC0C0&
Caption = " Reaching Time"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 12
Top = 3120
Width = 2175
End
Begin VB.Image Image3
Height = 315
Left = 5520
Picture = "p_booking_information.frx":148FF4
Top = 2760
Width = 300
End
Begin VB.Label Label6
BackColor = &H00FFC0C0&
Caption = " Starting Time"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 10
Top = 2760
Width = 2175
End
Begin VB.Image Image2
Height = 285
Left = 5520
Picture = "p_booking_information.frx":14B2E5
Top = 2400
Width = 300
End
Begin VB.Label Label5
BackColor = &H00FFC0C0&
Caption = " Travel Date"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 8
Top = 2400
Width = 2175
End
Begin VB.Image Image1
Height = 285
Left = 5520
Picture = "p_booking_information.frx":14B79D
Top = 2040
Width = 300
End
Begin VB.Label Label4
BackColor = &H00FFC0C0&
Caption = " Booking Date"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 5
Top = 2040
Width = 2175
End
Begin VB.Label Label3
BackColor = &H00FFC0C0&
Caption = " Category"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 3
Top = 1680
Width = 2175
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = " Booking Number"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 600
TabIndex = 2
Top = 1320
Width = 2175
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Booking Information"
BeginProperty Font
Name = "Verdana"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 495
Left = 3960
TabIndex = 0
Top = 240
Width = 4335
End
End
Attribute VB_Name = "p_booking_information"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bd, td As Boolean
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cn1 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim cn2 As ADODB.Connection
Dim rs2 As ADODB.Recordset
Dim add As Boolean
Private Sub Calendar1_Click()
If bd = True Then
Text2.Text = Calendar1.Month & "/" & Calendar1.Day & "/" & Calendar1.Year
Calendar1.Visible = False
bd = False
End If
If td = True Then
Text3.Text = Calendar1.Month & "/" & Calendar1.Day & "/" & Calendar1.Year
Calendar1.Visible = False
td = False
End If
End Sub
Private Sub Combo4_Click()
On Error Resume Next
l = rs1.RecordCount
If l <> 0 Then
rs1.MoveFirst
While (Not (rs1.EOF))
If rs1.Fields(0) = Combo4.Text Then
t = rs1.Fields(1)
For i = 1 To t
Combo5.AddItem (i)
Next i
End If
rs1.MoveNext
Wend
End If
End Sub
Private Sub Command1_Click()
add = True
clear
Text1.SetFocus
End Sub
Private Sub Command2_Click()
If add = True Then
add = False
rs.AddNew
save
rs.Update
MsgBox "The Record has been Saved"
display
Else
save
rs.Update
MsgBox "The Record has been Saved"
display
End If
End Sub
Private Sub Command3_Click()
clear
Text1.SetFocus
End Sub
Private Sub Command4_Click()
On Error Resume Next
rs.Delete
clear
MsgBox "The Record has been Deleted"
rs.MoveFirst
display
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
Private Sub Command5_Click()
On Error Resume Next
rs.MoveNext
display
If rs.EOF = True Then
MsgBox "This is the last record"
End If
End Sub
Private Sub Command6_Click()
On Error Resume Next
rs.MovePrevious
display
If rs.BOF = True Then
MsgBox "This is the first record"
End If
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set cn1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
Set cn2 = New ADODB.Connection
Set rs2 = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
rs.Open "select * from booking", cn, adOpenDynamic, adLockPessimistic
cn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
rs1.Open "select * from vehicle", cn, adOpenDynamic, adLockPessimistic
cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
rs2.Open "select * from services", cn, adOpenDynamic, adLockPessimistic
load_city
load_bus
rs.MoveFirst
display
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
Private Sub Image1_Click()
bd = True
td = False
Calendar1.Left = 2760
Calendar1.Top = 2360
Calendar1.Visible = True
End Sub
Private Sub Image2_Click()
td = True
bd = False
Calendar1.Left = 2760
Calendar1.Top = 2720
Calendar1.Visible = True
End Sub
Private Sub Image3_Click()
p_booking_information.Text4.Locked = False
time.Show
End Sub
Private Sub Image4_Click()
p_booking_information.Text5.Locked = False
time.Show
End Sub
Public Sub load_city()
On Error Resume Next
l = rs2.RecordCount
If l <> 0 Then
rs2.MoveFirst
While (Not (rs2.EOF))
Combo2.AddItem (rs2.Fields(1))
Combo3.AddItem (rs2.Fields(1))
rs2.MoveNext
Wend
End If
End Sub
Public Sub load_bus()
On Error Resume Next
l = rs1.RecordCount
If l <> 0 Then
rs1.MoveFirst
While (Not (rs1.EOF))
Combo4.AddItem (rs1.Fields(0))
rs1.MoveNext
Wend
End If
End Sub
Public Sub display()
Text1.Text = rs.Fields(0)
Combo1.Text = rs.Fields(1)
Text2.Text = rs.Fields(2)
Text3.Text = rs.Fields(3)
Text4.Text = rs.Fields(14)
Text5.Text = rs.Fields(15)
Combo2.Text = rs.Fields(4)
Combo3.Text = rs.Fields(5)
Combo4.Text = rs.Fields(9)
Combo5.Text = rs.Fields(10)
Text6.Text = rs.Fields(6)
Text7.Text = rs.Fields(7)
Text8.Text = rs.Fields(8)
Text9.Text = rs.Fields(11)
Text10.Text = rs.Fields(12)
Text11.Text = rs.Fields(13)
End Sub
Public Sub clear()
Text1.Text = ""
Combo1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
End Sub
Public Sub save()
rs.Fields(0) = Text1.Text
rs.Fields(1) = Combo1.Text
rs.Fields(2) = Text2.Text
rs.Fields(3) = Text3.Text
rs.Fields(14) = Text4.Text
rs.Fields(15) = Text5.Text
rs.Fields(4) = Combo2.Text
rs.Fields(5) = Combo3.Text
rs.Fields(9) = Combo4.Text
rs.Fields(10) = Combo5.Text
rs.Fields(6) = Text6.Text
rs.Fields(7) = Text7.Text
rs.Fields(8) = Text8.Text
rs.Fields(11) = Text9.Text
rs.Fields(12) = Text10.Text
rs.Fields(13) = Text11.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -