📄 frmrepairfind.frm
字号:
VERSION 5.00
Begin VB.Form frmrepairfind
BorderStyle = 1 'Fixed Single
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 4980
ClientTop = 2220
ClientWidth = 4860
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4860
Begin VB.CommandButton cmdcancel
Caption = "取 消"
Height = 375
Left = 3240
TabIndex = 13
Top = 2640
Width = 1095
End
Begin VB.CommandButton cmdok
Caption = "确 定"
Height = 375
Left = 1680
TabIndex = 12
Top = 2640
Width = 1095
End
Begin VB.Frame Frame1
Height = 1335
Left = 1560
TabIndex = 3
Top = 1080
Width = 2895
Begin VB.ComboBox cbomonth
Height = 300
Index = 1
Left = 1800
TabIndex = 15
Top = 840
Width = 615
End
Begin VB.ComboBox cbomonth
Height = 300
Index = 0
Left = 1800
TabIndex = 14
Top = 240
Width = 615
End
Begin VB.ComboBox cboyear
Height = 300
Index = 1
Left = 480
TabIndex = 8
Top = 840
Width = 855
End
Begin VB.ComboBox cboyear
Height = 300
Index = 0
Left = 480
TabIndex = 5
Top = 240
Width = 855
End
Begin VB.Label Label6
Caption = "月"
Height = 255
Left = 2520
TabIndex = 11
Top = 840
Width = 255
End
Begin VB.Label Label5
Caption = "月"
Height = 255
Left = 2520
TabIndex = 10
Top = 240
Width = 255
End
Begin VB.Label Label4
Caption = "年"
Height = 255
Left = 1440
TabIndex = 9
Top = 840
Width = 255
End
Begin VB.Label Label3
Caption = "到"
Height = 255
Left = 120
TabIndex = 7
Top = 840
Width = 255
End
Begin VB.Label Label2
Caption = "年"
Height = 255
Left = 1440
TabIndex = 6
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "从"
Height = 255
Left = 120
TabIndex = 4
Top = 240
Width = 255
End
End
Begin VB.TextBox txtid
Height = 375
Left = 1560
TabIndex = 2
Top = 480
Width = 2895
End
Begin VB.CheckBox Chkitem
Caption = "维修时间:"
Height = 375
Index = 1
Left = 240
TabIndex = 1
Top = 1080
Width = 1335
End
Begin VB.CheckBox Chkitem
Caption = "车牌号:"
Height = 375
Index = 0
Left = 240
TabIndex = 0
Top = 480
Value = 1 'Checked
Width = 1215
End
End
Attribute VB_Name = "frmrepairfind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub chkitem_Click(Index As Integer)
If Index = 1 Then
cboyear(0).SetFocus
Else
txtid.SetFocus
End If
End Sub
Private Sub cmdcancel_Click()
Me.Hide
End Sub
Private Sub cmdok_Click()
Dim txtsql As String
Dim dBeginDate As String
Dim dEndDateTemp As Date
Dim dEndDate As String
If chkitem(0).Value = vbChecked Then
txtsql = " wx_id ='" & Trim(txtid.Text & " ") & "'"
End If
If chkitem(1).Value = vbChecked Then
dBeginDate = Format(CDate(cboyear(0) & "-" & cbomonth(0) & "-1"), "yyyy-mm-dd")
dEndDateTemp = DateAdd("d", -1, DateAdd("m", 1, DateSerial(CInt(cboyear(1)), CInt(cbomonth(1)), 1)))
dEndDate = Format(dEndDateTemp, "yyyy-mm-dd")
If Trim(txtsql & " ") = "" Then
txtsql = " wx_date>='" & dBeginDate & "' and wx_date<='" & dEndDate & "'"
Else
txtsql = txtsql & " and (wx_date>='" & dBeginDate & "' and wx_date<='" & dEndDate & "')"
End If
Else
End If
If Trim(txtsql) = "" Then
MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
If flagrEdit Then
Unload frmrepair
End If
frmrepairlist.txtsql = "select * from repair where" & txtsql
frmrepairlist.Show
End If
Me.Hide
End Sub
Private Sub cobmonth_Click(Index As Integer)
If cbomonth(0) <> "" And cbomonth(1) <> "" Then
If CInt(cboyear(0)) = CInt(cboyear(1)) Then
Select Case Index
Case 0
If CInt(cbomonth(Index)) > CInt(cbomonth(1)) Then
cbomonth(Index) = cbomonth(1)
End If
Case 1
If CInt(cbomonth(Index)) < CInt(cbomonth(0)) Then
cbomonth(Index) = cbomonth(0)
End If
End Select
End If
End If
End Sub
Private Sub cobyear_Click(Index As Integer)
If cboyear(0) <> "" And cboyear(1) <> "" Then
Select Case Index
Case 0
If CInt(cboyear(Index)) > CInt(cboyear(1)) Then
cboyear(Index) = cboyear(1)
End If
Case 1
If CInt(cboyear(Index)) < CInt(cboyear(1)) Then
cboyear(Index) = cboyear(0)
End If
End Select
Call cobmonth_Click(Index)
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
Me.Left = 4935
Me.Top = 1890
txtsql = "select distinct datepart(yy,wx_date) from repair"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
With mrc
Do While Not .EOF
cboyear(0).AddItem .Fields(0)
cboyear(1).AddItem .Fields(0)
.MoveNext
Loop
End With
For i = 0 To 1
cboyear(i).ListIndex = 0
Next i
For i = 0 To 1
For j = 1 To 12
cbomonth(i).AddItem j
Next j
Next i
For i = 0 To 1
cbomonth(i).Text = Month(Now())
Next i
Else
CmdOK.Enabled = False
End If
mrc.Close
End Sub
Private Sub txtid_GotFocus()
txtid.SelStart = 0
txtid.SelLength = Len(txtid)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -