📄 search.frm
字号:
Left = 240
TabIndex = 2
Top = 360
Width = 2415
End
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Search && Status"
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 = 4320
TabIndex = 0
Top = 360
Width = 3375
End
End
Attribute VB_Name = "search"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn1, cn2, cn3 As ADODB.Connection
Dim rs1, rs2, rs3 As ADODB.Recordset
Private Sub Calendar1_Click()
Text2.Text = Calendar1.Month & "/" & Calendar1.Day & "/" & Calendar1.Year
Calendar1.Visible = False
End Sub
Private Sub Command1_Click()
If Option1.Value = True Then
Picture1.Visible = True
Label2.Caption = " Bus Code"
Label3.Caption = " Transport Date"
Text2.Locked = True
Image1.Visible = True
Text1.SetFocus
End If
If Option2.Value = True Then
Picture1.Visible = True
Label2.Caption = " Booking Number"
Label3.Caption = " Booking Date"
Text2.Locked = True
Image1.Visible = True
Text1.SetFocus
End If
If Option3.Value = True Then
Picture1.Visible = True
Label2.Caption = " Employee Number"
Label3.Caption = " First Name"
Text1.SetFocus
End If
If Option4.Value = True Then
Picture1.Visible = True
Label2.Caption = " Contact Code"
Label3.Caption = " First Name"
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
If Option1.Value = True Then
On Error Resume Next
If Check1.Value = 1 Or Check2.Value = 1 Then
load_booking1
List1.clear
l = rs1.RecordCount
rs1.MoveFirst
If l <> 0 Then
List1.AddItem ("Booking No Bus Code Seat No")
While (Not (rs1.EOF))
If rs1.Fields(9) = Text1.Text Or rs1.Fields(3) = Text2.Text Then
List1.AddItem (rs1.Fields(0) & " " & rs1.Fields(9) & " " & rs1.Fields(10))
End If
rs1.MoveNext
Wend
End If
End If
If Check1.Value = 1 And Check2.Value = 1 Then
load_booking1
List1.clear
l = rs1.RecordCount
rs1.MoveFirst
If l <> 0 Then
List1.AddItem ("Booking No Bus Code Seat No")
While (Not (rs1.EOF))
If rs1.Fields(3) = Text2.Text And rs1.Fields(9) = Text1.Text Then
List1.AddItem (rs1.Fields(0) & " " & rs1.Fields(9) & " " & rs1.Fields(10))
End If
rs1.MoveNext
Wend
End If
End If
End If
If Option2.Value = True Then
If Check1.Value = 1 Or Check2.Value = 1 Then
load_booking1
List1.clear
l = rs1.RecordCount
rs1.MoveFirst
If l <> 0 Then
List1.AddItem ("Booking No Booking Date Name")
While (Not (rs1.EOF))
If rs1.Fields(0) = Text1.Text Or rs1.Fields(2) = Text2.Text Then
List1.AddItem (rs1.Fields(0) & " " & rs1.Fields(2) & " " & rs1.Fields(6))
End If
rs1.MoveNext
Wend
End If
End If
If Check1.Value = 1 And Check2.Value = 1 Then
load_booking1
List1.clear
l = rs1.RecordCount
rs1.MoveFirst
If l <> 0 Then
List1.AddItem ("Booking No Bus Code Seat No")
While (Not (rs1.EOF))
If rs1.Fields(0) = Text1.Text Or rs1.Fields(2) = Text2.Text Then
List1.AddItem (rs1.Fields(0) & " " & rs1.Fields(2) & " " & rs1.Fields(6))
End If
rs1.MoveNext
Wend
End If
End If
End If
If Option3.Value = True Then
If Check1.Value = 1 Or Check2.Value = 1 Then
load_employee
List1.clear
l = rs2.RecordCount
rs2.MoveFirst
If l <> 0 Then
List1.AddItem ("Emp No Name Designation")
While (Not (rs2.EOF))
If rs2.Fields(0) = Text1.Text Or rs2.Fields(1) = Text2.Text Then
List1.AddItem (rs2.Fields(0) & " " & rs2.Fields(1) & " " & rs2.Fields(3))
End If
rs2.MoveNext
Wend
End If
End If
If Check1.Value = 1 And Check2.Value = 1 Then
load_employee
List1.clear
l = rs2.RecordCount
rs2.MoveFirst
If l <> 0 Then
List1.AddItem ("Emp No Name Designation")
While (Not (rs2.EOF))
If rs2.Fields(0) = Text1.Text And rs2.Fields(1) = Text2.Text Then
List1.AddItem (rs2.Fields(0) & " " & rs2.Fields(1) & " " & rs2.Fields(3))
End If
rs2.MoveNext
Wend
End If
End If
End If
If Option4.Value = True Then
If Check1.Value = 1 Or Check2.Value = 1 Then
load_contact
List1.clear
rs3.MoveFirst
l = rs3.RecordCount
rs3.MoveFirst
If l <> 0 Then
List1.AddItem ("Contact Code Name Designation")
While (Not (rs3.EOF))
If rs3.Fields(0) = Text1.Text Or rs3.Fields(1) = Text2.Text Then
List1.AddItem (rs3.Fields(0) & " " & rs3.Fields(1) & " " & rs3.Fields(3))
End If
rs3.MoveNext
Wend
End If
End If
If Check1.Value = 1 And Check2.Value = 1 Then
load_contact
List1.clear
rs3.MoveFirst
l = rs3.RecordCount
rs3.MoveFirst
If l <> 0 Then
List1.AddItem ("Contact Code Name Designation")
While (Not (rs3.EOF))
If rs3.Fields(0) = Text1.Text And rs3.Fields(1) = Text2.Text Then
List1.AddItem (rs3.Fields(0) & " " & rs3.Fields(1) & " " & rs3.Fields(3))
End If
rs3.MoveNext
Wend
End If
End If
End If
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
List1.clear
Text1.SetFocus
If Check2.Value = Checked Then
Check2.Value = Unchecked
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Check1.Value = 1
End Sub
Private Sub Image1_Click()
Calendar1.Visible = True
Calendar1.Top = 2160
Calendar1.Left = 6840
End Sub
Private Sub Option1_Click()
Picture1.Visible = False
Image1.Visible = False
End Sub
Private Sub Option2_Click()
Picture1.Visible = False
Image1.Visible = False
End Sub
Private Sub Option3_Click()
Picture1.Visible = False
Image1.Visible = False
End Sub
Private Sub Option4_Click()
Picture1.Visible = False
Image1.Visible = False
End Sub
Public Sub clear()
Text1.Text = ""
Text2.Text = ""
End Sub
Public Sub load_booking1()
On Error Resume Next
Set cn1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
cn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
rs1.Open "select * from booking", cn1, adOpenDynamic, adLockPessimistic
rs1.MoveFirst
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
Public Sub load_employee()
On Error Resume Next
Set cn2 = New ADODB.Connection
Set rs2 = New ADODB.Recordset
cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
rs2.Open "select * from employee", cn2, adOpenDynamic, adLockPessimistic
rs2.MoveFirst
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
Public Sub load_contact()
On Error Resume Next
Set cn3 = New ADODB.Connection
Set rs3 = New ADODB.Recordset
cn3.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
rs3.Open "select * from contacts", cn3, adOpenDynamic, adLockPessimistic
rs3.MoveFirst
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -