📄 frmpipelinefixquery_select.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmPipelineFixQuery_Select
BorderStyle = 1 'Fixed Single
Caption = "管网维护记录查询"
ClientHeight = 2265
ClientLeft = 45
ClientTop = 330
ClientWidth = 5820
Icon = "frmPipelineFixQuery_Select.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2265
ScaleWidth = 5820
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Caption = "查询条件"
ForeColor = &H8000000D&
Height = 1365
Left = 75
TabIndex = 6
Top = 120
Width = 5625
Begin MSComCtl2.DTPicker dtpFixDate1
Height = 300
Left = 2220
TabIndex = 3
Top = 885
Width = 1395
_ExtentX = 2461
_ExtentY = 529
_Version = 393216
Format = 23724033
CurrentDate = 37403
End
Begin MSComCtl2.DTPicker dtpReportDate1
Height = 300
Left = 2220
TabIndex = 1
Top = 570
Width = 1395
_ExtentX = 2461
_ExtentY = 529
_Version = 393216
Format = 23724033
CurrentDate = 37403
End
Begin VB.OptionButton optSearch
Caption = "按维修时间查询"
Height = 195
Index = 2
Left = 300
TabIndex = 9
Top = 945
Width = 1665
End
Begin VB.OptionButton optSearch
Caption = "按报修时间查询"
Height = 195
Index = 1
Left = 300
TabIndex = 8
Top = 630
Width = 1665
End
Begin VB.OptionButton optSearch
Caption = "按编号查询"
Height = 195
Index = 0
Left = 300
TabIndex = 7
Top = 300
Value = -1 'True
Width = 1665
End
Begin VB.TextBox txtPlID
Height = 300
Left = 2220
TabIndex = 0
Top = 240
Width = 1365
End
Begin MSComCtl2.DTPicker dtpReportDate2
Height = 300
Left = 3975
TabIndex = 2
Top = 570
Width = 1395
_ExtentX = 2461
_ExtentY = 529
_Version = 393216
Format = 23724033
CurrentDate = 37403
End
Begin MSComCtl2.DTPicker dtpFixDate2
Height = 300
Left = 3975
TabIndex = 4
Top = 885
Width = 1395
_ExtentX = 2461
_ExtentY = 529
_Version = 393216
Format = 23724033
CurrentDate = 37403
End
Begin VB.Label Label1
Caption = "到"
Height = 180
Index = 3
Left = 3705
TabIndex = 13
Top = 945
Width = 210
End
Begin VB.Label Label1
Caption = "从"
Height = 180
Index = 2
Left = 2010
TabIndex = 12
Top = 945
Width = 210
End
Begin VB.Label Label1
Caption = "到"
Height = 180
Index = 1
Left = 3705
TabIndex = 11
Top = 600
Width = 210
End
Begin VB.Label Label1
Caption = "从"
Height = 180
Index = 0
Left = 2010
TabIndex = 10
Top = 630
Width = 210
End
End
Begin VB.CommandButton cmdCB
Caption = "确定"
Height = 420
Index = 0
Left = 120
TabIndex = 5
Top = 1680
Width = 1065
End
Begin VB.Line Line1
BorderColor = &H80000003&
Index = 1
X1 = 15
X2 = 5730
Y1 = 1560
Y2 = 1560
End
Begin VB.Line Line1
BorderColor = &H80000005&
Index = 0
X1 = 30
X2 = 5730
Y1 = 1575
Y2 = 1575
End
End
Attribute VB_Name = "frmPipelineFixQuery_Select"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public strReturnSQL As String
Public strReturnTJ As String
Private Sub cmdCB_Click(Index As Integer)
'将查询到的信息返回到调用窗口并显示出来
Dim dDate1 As Date
Dim dDate2 As Date
If Me.optSearch(0).value = True Then '按编号
If Trim(Me.txtPlID.Text) <> "" Then
strReturnSQL = "select * from PipelineFix where PlID='" & Trim(Me.txtPlID.Text) & "'"
strReturnTJ = "编号: " & Trim(Me.txtPlID.Text)
End If
ElseIf Me.optSearch(1).value = True Then '按报修时间
'调整时间大小顺序
If Me.dtpReportDate1.value > Me.dtpReportDate2.value Then
dDate1 = Me.dtpReportDate2.value
dDate2 = Me.dtpReportDate1.value
Else
dDate1 = Me.dtpReportDate1.value
dDate2 = Me.dtpReportDate2.value
End If
strReturnSQL = "select * from PipelineFix where ReportDate>='" & dDate1 & "' and ReportDate<='" & dDate2 & "'"
strReturnTJ = "报修时间范围: 从 " & dDate1 & " 到 " & dDate2
ElseIf Me.optSearch(2).value = True Then '按维修时间
'调整时间大小顺序
If Me.dtpFixDate1.value > Me.dtpFixDate2.value Then
dDate1 = Me.dtpFixDate2.value
dDate2 = Me.dtpFixDate1.value
Else
dDate1 = Me.dtpFixDate1.value
dDate2 = Me.dtpFixDate2.value
End If
strReturnSQL = "select * from PipelineFix where FixDate>='" & dDate1 & "' and FixDate<='" & dDate2 & "'"
strReturnTJ = "维修时间范围: 从 " & dDate1 & " 到 " & dDate2
End If
Unload Me
End Sub
Private Sub Form_Load()
'初始化返回值
strReturnSQL = ""
strReturnTJ = ""
'设置关键控件的属性
Me.txtPlID.MaxLength = gPlIDLen
Me.optSearch(0).value = True
Me.txtPlID.Text = ""
Me.dtpReportDate1.value = Date
Me.dtpReportDate2.value = Date
Me.dtpFixDate1.value = Date
Me.dtpFixDate2.value = Date
Me.dtpReportDate1.Enabled = False
Me.dtpReportDate2.Enabled = False
Me.dtpFixDate1.Enabled = False
Me.dtpFixDate2.Enabled = False
End Sub
Private Sub optSearch_Click(Index As Integer)
Select Case Index
Case 0 '按编号
Me.txtPlID.Enabled = True
Me.txtPlID.SetFocus
Me.dtpReportDate1.value = Date
Me.dtpReportDate1.Enabled = False
Me.dtpReportDate2.value = Date
Me.dtpReportDate2.Enabled = False
Me.dtpFixDate1.value = Date
Me.dtpFixDate1.Enabled = False
Me.dtpFixDate2.value = Date
Me.dtpFixDate2.Enabled = False
Case 1 '按报修时间
Me.txtPlID.Text = ""
Me.txtPlID.Enabled = False
Me.dtpReportDate1.Enabled = True
Me.dtpReportDate2.Enabled = True
Me.dtpReportDate1.SetFocus
Me.dtpFixDate1.value = Date
Me.dtpFixDate1.Enabled = False
Me.dtpFixDate2.value = Date
Me.dtpFixDate2.Enabled = False
Case 2 '按维修时间
Me.txtPlID.Text = ""
Me.txtPlID.Enabled = False
Me.dtpReportDate1.value = Date
Me.dtpReportDate1.Enabled = False
Me.dtpReportDate2.value = Date
Me.dtpReportDate2.Enabled = False
Me.dtpFixDate1.Enabled = True
Me.dtpFixDate2.Enabled = True
Me.dtpFixDate1.SetFocus
Case Else
MsgBox "按扭功能未定义", vbOKOnly + vbExclamation, "警告"
End Select
End Sub
Private Sub txtPlID_KeyPress(KeyAscii As Integer)
Call IfEnterKeyMoveNext(KeyAscii)
End Sub
Private Sub txtPlID_LostFocus()
If Trim(Me.txtPlID.Text) = "" Then Exit Sub
Me.txtPlID.Text = String(gPlIDLen - Len(Trim(Me.txtPlID.Text)), "0") & Trim(Me.txtPlID.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -