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

📄 frmreturn2.frm

📁 一个用VB和SQL Server写的图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmReturn2 
   Caption         =   "还书信息查询"
   ClientHeight    =   2400
   ClientLeft      =   48
   ClientTop       =   348
   ClientWidth     =   4956
   LinkTopic       =   "Form1"
   ScaleHeight     =   2400
   ScaleWidth      =   4956
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdExit 
      Caption         =   "取消 (&X)"
      Height          =   375
      Left            =   2760
      TabIndex        =   13
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定 (&O)"
      Default         =   -1  'True
      Height          =   375
      Left            =   1200
      TabIndex        =   12
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   0
      Left            =   120
      TabIndex        =   11
      TabStop         =   0   'False
      Top             =   120
      Value           =   1  'Checked
      Width           =   132
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   1
      Left            =   120
      TabIndex        =   10
      TabStop         =   0   'False
      Top             =   480
      Width           =   132
   End
   Begin VB.Frame Frame1 
      Height          =   732
      Left            =   1440
      TabIndex        =   3
      Top             =   840
      Width           =   3252
      Begin VB.ComboBox cboYear 
         Height          =   288
         Index           =   0
         Left            =   192
         Style           =   2  'Dropdown List
         TabIndex        =   6
         Top             =   240
         Width           =   765
      End
      Begin VB.ComboBox cboMonth 
         Height          =   288
         Index           =   0
         Left            =   1368
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   240
         Width           =   645
      End
      Begin VB.ComboBox cboDay 
         Height          =   288
         Left            =   2280
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   240
         Width           =   612
      End
      Begin VB.Label Label1 
         Caption         =   "月"
         Height          =   216
         Index           =   2
         Left            =   2040
         TabIndex        =   9
         Top             =   240
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   216
         Index           =   1
         Left            =   1032
         TabIndex        =   8
         Top             =   240
         Width           =   240
      End
      Begin VB.Label Label1 
         Caption         =   "日"
         Height          =   216
         Index           =   7
         Left            =   3000
         TabIndex        =   7
         Top             =   240
         Width           =   120
      End
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   2
      Left            =   120
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   960
      Width           =   132
   End
   Begin VB.TextBox txtItem 
      Height          =   270
      Index           =   1
      Left            =   1440
      TabIndex        =   1
      Top             =   480
      Width           =   3252
   End
   Begin VB.TextBox txtItem 
      Height          =   270
      Index           =   0
      Left            =   1440
      TabIndex        =   0
      Top             =   120
      Width           =   3252
   End
   Begin VB.Label lblitem 
      Caption         =   "读者姓名:"
      Height          =   252
      Index           =   0
      Left            =   480
      TabIndex        =   16
      Top             =   120
      Width           =   1092
   End
   Begin VB.Label lblitem 
      Caption         =   "还书时间:"
      Height          =   252
      Index           =   1
      Left            =   480
      TabIndex        =   15
      Top             =   960
      Width           =   1092
   End
   Begin VB.Label lblitem 
      Caption         =   "书籍姓名:"
      Height          =   252
      Index           =   2
      Left            =   480
      TabIndex        =   14
      Top             =   480
      Width           =   1092
   End
End
Attribute VB_Name = "frmReturn2"
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 = 2 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 dBeginDate As String
    Dim sQSql As String
    
    If chkItem(0).Value = vbChecked Then
        sQSql = " readername = '" & Trim(txtItem(0) & " ") & "'"
    End If
    
    If chkItem(1).Value = vbChecked Then
        If Trim(sQSql & " ") = "" Then
            sQSql = " bookname ='" & Trim(txtItem(1) & " ") & "'"
        Else
            sQSql = sQSql & " and bookname ='" & Trim(txtItem(1) & " ") & "'"
        End If
    End If
    
    If chkItem(2).Value = vbChecked Then
        dBeginDate = Format(CDate(cboYear(0) & "-" & cboMonth(0) & "-" & cboDay), "yyyy-mm-dd")
        
        
        If Trim(sQSql & " ") = "" Then
            sQSql = " returndate ='" & dBeginDate & "'"
        Else
            sQSql = sQSql & " and returndate ='" & dBeginDate & "'"
        End If
        
    
    End If
    
    If Trim(sQSql) = "" Then
        MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        If flagBBedit Then
            Unload frmReturn
        End If
        frmReturn.txtSQL = "select * from borrowinfo where returndate is not null and " & sQSql
        frmReturn.Show
    End If
    Me.Hide
End Sub

Private Sub Form_Load()
    
    
    Dim i As Integer
    Dim j As Integer
    Dim sSql As String
    Dim txtSQL As String
    Dim MsgText As String
    Dim mrc As ADODB.Recordset
    
  
    txtSQL = "select distinct datepart(yy,borrowdate) from borrowinfo where returndate is not null "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        With mrc
            Do While Not .EOF
                cboYear(0).AddItem .Fields(0)
                .MoveNext
            Loop
        End With
        
        cboYear(0).ListIndex = 0
        
        For j = 1 To 12
            cboMonth(0).AddItem j
        Next j
        cboMonth(0).Text = Month(Now())
        
        For j = 1 To 31
            cboDay.AddItem j
        Next j
        cboDay.Text = Day(Now())
        
    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 + -