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

📄 form12.frm

📁 VB编写的企业管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form10 
   BackColor       =   &H00FFC0C0&
   Caption         =   "员工调动信息"
   ClientHeight    =   8655
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9345
   Icon            =   "Form12.frx":0000
   LinkTopic       =   "Form10"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8655
   ScaleWidth      =   9345
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox Check2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "时间"
      Height          =   255
      Left            =   840
      TabIndex        =   16
      Top             =   3120
      Width           =   855
   End
   Begin VB.ComboBox Combo5 
      Height          =   300
      Left            =   3360
      TabIndex        =   15
      Top             =   2280
      Width           =   2535
   End
   Begin VB.CheckBox Check1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "员工编号"
      Height          =   375
      Left            =   840
      TabIndex        =   14
      Top             =   2160
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "时间"
      DragMode        =   1  'Automatic
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2535
      Left            =   960
      TabIndex        =   3
      Top             =   3960
      Width           =   5895
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1200
         TabIndex        =   7
         Top             =   480
         Width           =   1095
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   3480
         TabIndex        =   6
         Top             =   480
         Width           =   1095
      End
      Begin VB.ComboBox Combo3 
         Height          =   300
         Left            =   1200
         TabIndex        =   5
         Top             =   1440
         Width           =   1095
      End
      Begin VB.ComboBox Combo4 
         Height          =   300
         Left            =   3480
         TabIndex        =   4
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0C0&
         Caption         =   "从"
         Height          =   255
         Left            =   600
         TabIndex        =   13
         Top             =   480
         Width           =   495
      End
      Begin VB.Label Label3 
         BackColor       =   &H00FFC0C0&
         Caption         =   " 年"
         Height          =   375
         Left            =   2400
         TabIndex        =   12
         Top             =   480
         Width           =   495
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFC0C0&
         Caption         =   "到"
         Height          =   375
         Left            =   600
         TabIndex        =   11
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label5 
         BackColor       =   &H00FFC0C0&
         Caption         =   " 年"
         Height          =   375
         Left            =   2400
         TabIndex        =   10
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label6 
         BackColor       =   &H00FFC0C0&
         Caption         =   "月"
         Height          =   375
         Left            =   4800
         TabIndex        =   9
         Top             =   600
         Width           =   615
      End
      Begin VB.Label Label7 
         BackColor       =   &H00FFC0C0&
         Caption         =   "月"
         Height          =   375
         Left            =   4800
         TabIndex        =   8
         Top             =   1560
         Width           =   615
      End
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "确定"
      Height          =   495
      Left            =   1680
      TabIndex        =   2
      Top             =   7440
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "取消"
      Height          =   495
      Left            =   4560
      TabIndex        =   1
      Top             =   7440
      Width           =   1095
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "            选择查询条件"
      BeginProperty Font 
         Name            =   "华文行楷"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   495
      Left            =   2160
      TabIndex        =   0
      Top             =   720
      Width           =   4335
   End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private strQuery As String
Private fromtime As String                           '开始时间
Private totime As String                             '结束时间

Private Sub setstrQuery()
    fromtime = Me.Combo1 & "-" & Me.Combo2 & "-1"
    totime = Me.Combo3 & "-" & Me.Combo4 & "-1"
    If Me.Check1.Value = vbChecked And Me.Check2.Value = vbChecked Then
        strQuery = "select * from away where aid='" & Me.Combo5.Text
        strQuery = strQuery & "' and aouttime between #" & fromtime & "# and #"
        strQuery = strQuery & totime & "#"
        MsgBox strQuery
    ElseIf Me.Check1.Value = vbChecked Then
        strQuery = "select * from away where aid='" & Me.Combo5.Text & "' order by ID"
    ElseIf Me.Check2.Value = vbChecked Then
        strQuery = "select * from away where aouttime between #" & fromtime
        strQuery = strQuery & "# and #" & totime & "# order by ID"
    Else
        strQuery = "select * from away order by ID"
    End If
End Sub

Private Sub Combo4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Private Sub Command1_Click()
 Call setstrQuery
  Form12.Adodc1.ConnectionString = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\person.mdb"
  Form12.Adodc1.RecordSource = strQuery
    If strQuery <> "" Then
        Form12.Adodc1.Refresh
    End If
    Set Form12.DataGrid1.DataSource = Form12.Adodc1.Recordset
    Form12.DataGrid1.Refresh
    Form12.Show
    Form12.ZOrder 0
    Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
    Exit Sub
End Sub



Private Sub Form_Load()
 Dim i As Integer
    Dim sql As String
    Dim rs As New ADODB.Recordset
    sql = "select distinct aid from away order by aid"
    Set rs = TransactSQL(sql)
    If rs.EOF = False Then
        rs.MoveFirst
        While Not rs.EOF
            Me.Combo5.AddItem rs(0)
            rs.MoveNext
        Wend
        Me.Combo5.ListIndex = 0
    End If
    rs.Close
    sql = "select distinct aouttime from away"
    Set rs = TransactSQL(sql)
    If Not rs.EOF Then
        rs.MoveFirst
        While Not rs.EOF
            If Not IsNull(rs.Fields(0)) Then            '设置年
                Me.Combo1.AddItem Left(rs(0), 4)
                Me.Combo3.AddItem Left(rs(0), 4)
            End If
            rs.MoveNext
        Wend
        rs.Close
        Me.Combo1.ListIndex = 0
        Me.Combo3.ListIndex = 0
    End If
    For i = 1 To 12                                     '设置月
        Me.Combo2.AddItem i
        Me.Combo4.AddItem i
    Next i
        Me.Combo2.ListIndex = 0
        Me.Combo4.ListIndex = 0
End Sub

⌨️ 快捷键说明

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