?? 報修查詢.frm
字號:
VERSION 5.00
Begin VB.Form frmQueryBx
BorderStyle = 1 'Fixed Single
Caption = "住戶報修查詢"
ClientHeight = 4650
ClientLeft = 45
ClientTop = 330
ClientWidth = 8265
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4650
ScaleWidth = 8265
Begin VB.CommandButton cmdClose
Caption = "關 閉"
Height = 495
Left = 4440
TabIndex = 26
Top = 3840
Width = 1335
End
Begin VB.CommandButton cmdQuery
Caption = "查 詢"
Height = 495
Left = 2160
TabIndex = 25
Top = 3840
Width = 1335
End
Begin VB.Frame Frame1
Caption = "請輸入查詢條件"
Height = 3375
Left = 120
TabIndex = 0
Top = 240
Width = 7815
Begin VB.ComboBox Combo8
Height = 300
ItemData = "報修查詢.frx":0000
Left = 2160
List = "報修查詢.frx":000D
TabIndex = 10
Text = "Combo7"
Top = 2640
Width = 855
End
Begin VB.ComboBox Combo5
Height = 300
ItemData = "報修查詢.frx":001A
Left = 2160
List = "報修查詢.frx":0027
TabIndex = 6
Text = "Combo7"
Top = 1680
Width = 855
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "報修查詢.frx":0034
Left = 2160
List = "報修查詢.frx":0041
TabIndex = 2
Text = "Combo7"
Top = 720
Width = 855
End
Begin VB.ComboBox Combo9
Height = 300
ItemData = "報修查詢.frx":004E
Left = 6480
List = "報修查詢.frx":005B
TabIndex = 12
Tag = "0"
Text = "Combo2"
Top = 2640
Width = 735
End
Begin VB.TextBox Text3
Height = 375
Left = 3360
TabIndex = 11
Top = 2640
Width = 2775
End
Begin VB.ComboBox Combo7
Height = 300
ItemData = "報修查詢.frx":006D
Left = 600
List = "報修查詢.frx":0080
TabIndex = 9
Text = "Combo1"
Top = 2640
Width = 1095
End
Begin VB.ComboBox Combo6
Height = 300
ItemData = "報修查詢.frx":00B6
Left = 6480
List = "報修查詢.frx":00C3
TabIndex = 8
Tag = "0"
Text = "Combo2"
Top = 1680
Width = 735
End
Begin VB.TextBox Text2
Height = 375
Left = 3360
TabIndex = 7
Top = 1680
Width = 2775
End
Begin VB.ComboBox Combo4
Height = 300
ItemData = "報修查詢.frx":00D5
Left = 600
List = "報修查詢.frx":00E8
TabIndex = 5
Text = "Combo1"
Top = 1680
Width = 1095
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "報修查詢.frx":011E
Left = 6480
List = "報修查詢.frx":012B
TabIndex = 4
Tag = "0"
Text = "Combo2"
Top = 720
Width = 735
End
Begin VB.TextBox Text1
Height = 375
Left = 3360
TabIndex = 3
Top = 720
Width = 2775
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "報修查詢.frx":013D
Left = 600
List = "報修查詢.frx":0150
TabIndex = 1
Text = "Combo1"
Top = 720
Width = 1095
End
Begin VB.Label Label12
Caption = "查找關系"
Height = 255
Left = 2160
TabIndex = 24
Top = 2280
Width = 855
End
Begin VB.Label Label11
Caption = "查找關系"
Height = 255
Left = 2160
TabIndex = 23
Top = 1320
Width = 855
End
Begin VB.Label Label10
Caption = "查找關系"
Height = 255
Left = 2160
TabIndex = 22
Top = 360
Width = 855
End
Begin VB.Label Label9
Caption = "邏輯關系"
Height = 255
Left = 6480
TabIndex = 21
Top = 2280
Width = 735
End
Begin VB.Label Label8
Caption = "查找值"
Height = 255
Left = 4560
TabIndex = 20
Top = 2280
Width = 615
End
Begin VB.Label Label7
Caption = "查找字段"
Height = 255
Left = 720
TabIndex = 19
Top = 2280
Width = 855
End
Begin VB.Label Label6
Caption = "邏輯關系"
Height = 255
Left = 6480
TabIndex = 18
Top = 1320
Width = 735
End
Begin VB.Label Label5
Caption = "查找值"
Height = 255
Left = 4560
TabIndex = 17
Top = 1320
Width = 615
End
Begin VB.Label Label4
Caption = "查找字段"
Height = 255
Left = 720
TabIndex = 16
Top = 1320
Width = 855
End
Begin VB.Label Label3
Caption = "邏輯關系"
Height = 255
Left = 6480
TabIndex = 15
Top = 360
Width = 735
End
Begin VB.Label Label2
Caption = "查找值"
Height = 255
Left = 4560
TabIndex = 14
Top = 360
Width = 615
End
Begin VB.Label Label1
Caption = "查找字段"
Height = 255
Left = 720
TabIndex = 13
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "frmQueryBx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdQuery_Click()
'要求至少要有一個查詢條件,而且查詢條件要靠前寫,即如果只有一個查詢條件
'必須輸在第一行,有2個查詢條件,只能輸在1,2兩行上
If Text1.Text = "" Then
MsgBox "請輸入至少一個查詢條件,或把查詢條件輸入在前面的行上!", vbOKOnly + vbInformation, "注意"
Text1.SetFocus
Text2.Text = ""
Text3.Text = ""
Exit Sub
End If
If Text2.Text = "" And Not Text3.Text = "" Then
MsgBox "請把查詢條件輸入在前面的行上!", vbOKOnly + vbInformation, "注意"
Text2.SetFocus
Text3.Text = ""
Exit Sub
End If
'除使日期以外的查詢字段其查詢關系不能為> 或 <,判斷之
If Not Text1.Text = "" And Not Combo1.ListIndex = 2 And Not Combo1.ListIndex = 4 And Not Combo2.ListIndex = 0 Then
MsgBox "該字段的查找關系不能為 > 或 < !", vbOKOnly + vbInformation, "注意"
Combo2.SetFocus
Exit Sub
End If
If Not Text2.Text = "" And Not Combo4.ListIndex = 2 And Not Combo4.ListIndex = 4 And Not Combo5.ListIndex = 0 Then
MsgBox "該字段的查找關系不能為 > 或 < !", vbOKOnly + vbInformation, "注意"
Combo5.SetFocus
Exit Sub
End If
If Not Text3.Text = "" And Not Combo7.ListIndex = 2 And Not Combo7.ListIndex = 4 And Not Combo8.ListIndex = 0 Then
MsgBox "該字段的查找關系不能為 > 或 < !", vbOKOnly + vbInformation, "注意"
Combo8.SetFocus
Exit Sub
End If
'設置查詢判斷變量為真
queryBx = True
'使用全局變量sqlBx保存該查詢表達式的sql 語句
'如果查詢字段是日期,則需要轉換text1.text的內容
If Combo1.ListIndex = 2 Or Combo1.ListIndex = 4 Then
'先要判斷輸入的是否為日期型
If IsDate(Text1.Text) = False Then
MsgBox "輸入的不是日期型內容,請輸入這樣的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
Exit Sub
End If
'DateValue 函數把字符串轉換為數字
sqlBx = "where " & Combo1.Text & Combo2.Text & "#" & DateValue(Text1.Text) & "#"
Else
sqlBx = "where " & Combo1.Text & Combo2.Text & "'" & Text1.Text & "'"
End If
If Not Text2.Text = "" Then
If Combo4.ListIndex = 2 Or Combo4.ListIndex = 4 Then
If IsDate(Text2.Text) = False Then
MsgBox "輸入的不是日期型內容,請輸入這樣的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
Exit Sub
End If
'combo3.text是and or not 等邏輯字符,其前后需要各加上一個空格
sqlBx = sqlBx & " " & Combo3.Text & " " & Combo4.Text & Combo5.Text & "#" & DateValue(Text2.Text) & "#"
Else
sqlBx = sqlBx & " " & Combo3.Text & " " & Combo4.Text & Combo5.Text & "'" & Text2.Text & "'"
End If
End If
If Not Text3.Text = "" Then
If Combo7.ListIndex = 2 Or Combo7.ListIndex = 4 Then
If IsDate(Text3.Text) = False Then
MsgBox "輸入的不是日期型內容,請輸入這樣的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
Exit Sub
End If
sqlBx = sqlBx & " " & Combo6.Text & " " & Combo7.Text & Combo8.Text & "#" & DateValue(Text3.Text) & "#"
Else
sqlBx = sqlBx & " " & Combo6.Text & " " & Combo7.Text & Combo8.Text & "'" & Text3.Text & "'"
End If
End If
frmBaoXiu.Show
Unload Me
End Sub
Private Sub Form_Load()
'讓窗體居中
Dim X0 As Long
Dim Y0 As Long
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
Combo1.ListIndex = 0
Combo2.ListIndex = 0
Combo3.ListIndex = 0
Combo4.ListIndex = 0
Combo5.ListIndex = 0
Combo6.ListIndex = 0
Combo7.ListIndex = 0
Combo8.ListIndex = 0
Combo9.ListIndex = 0
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -