⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmrepair2.frm

📁 车辆管理信息系统,一个非常好的vb源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmRepair2 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "车辆维修查询"
   ClientHeight    =   2256
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   4704
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2256
   ScaleWidth      =   4704
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.Frame Frame1 
      Height          =   1095
      Left            =   1560
      TabIndex        =   11
      Top             =   600
      Width           =   2895
      Begin VB.ComboBox cboMonth 
         Height          =   300
         Index           =   0
         Left            =   1845
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   240
         Width           =   645
      End
      Begin VB.ComboBox cboMonth 
         Height          =   300
         Index           =   1
         Left            =   1845
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   690
         Width           =   645
      End
      Begin VB.ComboBox cboYear 
         Height          =   300
         Index           =   0
         Left            =   675
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   240
         Width           =   765
      End
      Begin VB.ComboBox cboYear 
         Height          =   300
         Index           =   1
         Left            =   675
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   690
         Width           =   765
      End
      Begin VB.Label Label1 
         Caption         =   "月"
         Height          =   210
         Index           =   7
         Left            =   2520
         TabIndex        =   17
         Top             =   720
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "从:"
         Height          =   210
         Index           =   6
         Left            =   240
         TabIndex        =   16
         Top             =   240
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   210
         Index           =   1
         Left            =   1515
         TabIndex        =   15
         Top             =   240
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "月"
         Height          =   210
         Index           =   2
         Left            =   2520
         TabIndex        =   14
         Top             =   240
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "到:"
         Height          =   210
         Index           =   3
         Left            =   255
         TabIndex        =   13
         Top             =   735
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   210
         Index           =   4
         Left            =   1545
         TabIndex        =   12
         Top             =   735
         Width           =   225
      End
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   1
      Left            =   240
      TabIndex        =   10
      Top             =   720
      Width           =   132
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   0
      Left            =   240
      TabIndex        =   9
      Top             =   240
      Value           =   1  'Checked
      Width           =   132
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定 (&O)"
      Default         =   -1  'True
      Height          =   375
      Left            =   960
      TabIndex        =   5
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "取消 (&X)"
      Height          =   375
      Left            =   2520
      TabIndex        =   6
      Top             =   1800
      Width           =   1215
   End
   Begin VB.TextBox txtItem 
      Height          =   270
      Index           =   0
      Left            =   1560
      TabIndex        =   0
      Top             =   240
      Width           =   2895
   End
   Begin VB.Label lblitem 
      Caption         =   "维修时间:"
      Height          =   255
      Index           =   1
      Left            =   600
      TabIndex        =   8
      Top             =   720
      Width           =   1095
   End
   Begin VB.Label lblitem 
      Caption         =   "车 牌 号:"
      Height          =   255
      Index           =   0
      Left            =   600
      TabIndex        =   7
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "frmRepair2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit



Private Sub cboMonth_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 cboYear_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 cboMonth_Click(Index)
End If
End Sub

Private Sub chkItem_Click(Index As Integer)
    If Index = 1 Then
        cboYear(0).SetFocus
    Else
        txtItem(Index).SetFocus
    End If
End Sub

Private Sub cmdExit_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 = " wxid ='" & Trim(txtItem(0) & " ") & "'"
    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 = " wxdate>='" & dBeginDate & "' and wxdate<='" & dEndDate & "'"
        Else
            txtSQL = txtSQL & " and (wxdate>='" & dBeginDate & "' and wxdate<='" & dEndDate & "')"
        End If
         
    Else
    End If
    
    If Trim(txtSQL) = "" Then
        MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        
        If flagrEdit Then
            Unload frmRepair
        End If
        frmRepair.txtSQL = "select * from repair where" & txtSQL
        frmRepair.Show
    End If
    Me.Hide
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
    
  
    txtSQL = "select distinct datepart(yy,wxdate) 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 lblitem_Click(Index As Integer)
    chkItem(Index).Value = vbChecked
End Sub

Private Sub txtItem_GotFocus(Index As Integer)

    txtItem(Index).SelStart = 0
    txtItem(Index).SelLength = Len(txtItem(Index))
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -