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

📄 frmaccidentfind.frm

📁 车辆管理系统是一个协助各单位进行全面的车辆管理的系统。包括车辆档案管理;驾驶员档案管理;车辆运营信息管理;车辆事故信息管理;车辆维修信息管理;车辆费用管理等几个功能模块。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmaccidentfind 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "事故信息查询"
   ClientHeight    =   2820
   ClientLeft      =   5550
   ClientTop       =   2025
   ClientWidth     =   4515
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2820
   ScaleWidth      =   4515
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取 消"
      Height          =   375
      Left            =   2760
      TabIndex        =   15
      Top             =   2280
      Width           =   975
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确 定"
      Height          =   375
      Left            =   1560
      TabIndex        =   14
      Top             =   2280
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Height          =   1335
      Left            =   1320
      TabIndex        =   3
      Top             =   720
      Width           =   2895
      Begin VB.ComboBox cbomonth 
         Height          =   300
         Index           =   1
         Left            =   1800
         TabIndex        =   13
         Top             =   840
         Width           =   615
      End
      Begin VB.ComboBox cbomonth 
         Height          =   300
         Index           =   0
         Left            =   1800
         TabIndex        =   12
         Top             =   240
         Width           =   615
      End
      Begin VB.ComboBox Cboyear 
         Height          =   300
         Index           =   1
         Left            =   480
         TabIndex        =   11
         Top             =   840
         Width           =   855
      End
      Begin VB.ComboBox Cboyear 
         Height          =   300
         Index           =   0
         Left            =   480
         TabIndex        =   10
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label6 
         Caption         =   "月"
         Height          =   375
         Left            =   2520
         TabIndex        =   9
         Top             =   840
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "到"
         Height          =   255
         Left            =   1440
         TabIndex        =   8
         Top             =   840
         Width           =   375
      End
      Begin VB.Label Label4 
         Caption         =   "到"
         Height          =   255
         Left            =   120
         TabIndex        =   7
         Top             =   840
         Width           =   375
      End
      Begin VB.Label Label3 
         Caption         =   "月"
         Height          =   255
         Left            =   2520
         TabIndex        =   6
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label2 
         Caption         =   "年"
         Height          =   255
         Left            =   1440
         TabIndex        =   5
         Top             =   240
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "从"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   255
      End
   End
   Begin VB.CheckBox chkitem 
      Caption         =   "事故时间:"
      Height          =   375
      Index           =   1
      Left            =   120
      TabIndex        =   2
      Top             =   720
      Width           =   1215
   End
   Begin VB.TextBox Txtitem 
      Height          =   375
      Left            =   1320
      TabIndex        =   1
      Top             =   120
      Width           =   2775
   End
   Begin VB.CheckBox chkitem 
      Caption         =   "车牌:"
      Height          =   375
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Value           =   1  'Checked
      Width           =   1095
   End
End
Attribute VB_Name = "frmaccidentfind"
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.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 = " sg_id ='" & Trim(txtitem.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 = " sg_date>='" & dBeginDate & "' and sg_date<='" & dEndDate & "'"
        Else
            txtsql = txtsql & " and (sg_date>='" & dBeginDate & "' and sg_date<='" & dEndDate & "')"
        End If
         
    Else
    End If
    
    If Trim(txtsql) = "" Then
        MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        
        If flagrEdit Then
            Unload frmaccident
        End If
        frmaccidentlist.txtsql = "select * from accident where" & txtsql
        frmaccidentlist.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
    frmaccidentfind.Left = 5505
    frmaccidentfind.Top = 1695
    
  
    txtsql = "select distinct datepart(yy,sg_date) from accident"
    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 txtitem_GotFocus()
   txtitem.SelStart = 0
   txtitem.SelLength = Len(txtitem)
End Sub

⌨️ 快捷键说明

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