frmBook2.frm
资源名称:图书馆管理系统11.rar [点击查看]
上传用户:wang_li173
上传日期:2007-06-22
资源大小:43k
文件大小:7k
源码类别:
系统设计方案
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form frmBook2
- BorderStyle = 3 'Fixed Dialog
- Caption = "书籍信息查询"
- ClientHeight = 2736
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 4128
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2736
- ScaleWidth = 4128
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 'CenterOwner
- Begin VB.CheckBox chkItem
- Caption = "Check1"
- Height = 180
- Index = 3
- Left = 240
- TabIndex = 13
- TabStop = 0 'False
- Top = 1560
- Width = 132
- End
- Begin VB.CheckBox chkItem
- Caption = "Check1"
- Height = 180
- Index = 2
- Left = 240
- TabIndex = 12
- TabStop = 0 'False
- Top = 1080
- Width = 132
- End
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 0
- Left = 1560
- Style = 2 'Dropdown List
- TabIndex = 7
- Top = 600
- Width = 2175
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 0
- Left = 1560
- MaxLength = 20
- TabIndex = 6
- Top = 120
- Width = 2175
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 1
- Left = 1560
- MaxLength = 20
- TabIndex = 5
- Top = 1080
- Width = 2175
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 2
- Left = 1560
- MaxLength = 20
- TabIndex = 4
- Top = 1560
- Width = 2172
- End
- Begin VB.CheckBox chkItem
- Caption = "Check1"
- Height = 180
- Index = 1
- Left = 240
- TabIndex = 3
- TabStop = 0 'False
- Top = 600
- Width = 132
- End
- Begin VB.CheckBox chkItem
- Caption = "Check1"
- Height = 180
- Index = 0
- Left = 240
- TabIndex = 2
- TabStop = 0 'False
- Top = 120
- Value = 1 'Checked
- Width = 132
- End
- Begin VB.CommandButton cmdOk
- Caption = "确定 (&O)"
- Default = -1 'True
- Height = 375
- Left = 1080
- TabIndex = 0
- Top = 2160
- Width = 1215
- End
- Begin VB.CommandButton cmdExit
- Caption = "取消 (&X)"
- Height = 375
- Left = 2640
- TabIndex = 1
- Top = 2160
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "作者姓名:"
- Height = 252
- Index = 16
- Left = 600
- TabIndex = 11
- Top = 1080
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "书籍类别:"
- Height = 252
- Index = 1
- Left = 600
- TabIndex = 10
- Top = 600
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "书籍名称:"
- Height = 252
- Index = 0
- Left = 600
- TabIndex = 9
- Top = 120
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "出版社名称:"
- Height = 252
- Index = 3
- Left = 600
- TabIndex = 8
- Top = 1560
- Width = 972
- End
- End
- Attribute VB_Name = "frmBook2"
- 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 = 0 Then
- txtItem(0).SetFocus
- ElseIf Index = 1 Then
- txtItem(1).SetFocus
- ElseIf Index = 3 Then
- txtItem(2).SetFocus
- Else
- cboItem(0).SetFocus
- End If
- End Sub
- Private Sub cmdExit_Click()
- Me.Hide
- End Sub
- Private Sub cmdOK_Click()
- Dim sQSql As String
- If chkItem(0).Value = vbChecked Then
- sQSql = " bookname = '" & Trim(txtItem(0) & " ") & "'"
- End If
- If chkItem(1).Value = vbChecked Then
- If Trim(sQSql & " ") = "" Then
- sQSql = " booktype ='" & Trim(cboItem(0) & " ") & "'"
- Else
- sQSql = sQSql & " and booktype ='" & Trim(cboItem(0) & " ") & "'"
- End If
- End If
- If chkItem(2).Value = vbChecked Then
- If Trim(sQSql & " ") = "" Then
- sQSql = " bookauthor ='" & Trim(txtItem(1) & " ") & "'"
- Else
- sQSql = sQSql & " and bookauthor ='" & Trim(txtItem(1) & " ") & "'"
- End If
- End If
- If chkItem(3).Value = vbChecked Then
- If Trim(sQSql & " ") = "" Then
- sQSql = " bookpub ='" & Trim(txtItem(2) & " ") & "'"
- Else
- sQSql = sQSql & " and bookpub ='" & Trim(txtItem(2) & " ") & "'"
- End If
- End If
- If Trim(sQSql) = "" Then
- MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- Else
- If flagBedit Then
- Unload frmBook
- End If
- frmBook.txtSQL = "select * from books where" & sQSql
- frmBook.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 typename from booktype"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- Do While Not mrc.EOF
- cboItem(0).AddItem Trim(mrc.Fields(0))
- mrc.MoveNext
- Loop
- cboItem(0).ListIndex = 0
- Else
- MsgBox "请先进行书籍类别设置!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- 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