frmReader2.frm
上传用户:wang_li173
上传日期:2007-06-22
资源大小:43k
文件大小:6k
源码类别:

系统设计方案

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmReader2 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "读者信息查询"
  5.    ClientHeight    =   2256
  6.    ClientLeft      =   48
  7.    ClientTop       =   336
  8.    ClientWidth     =   4068
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2256
  13.    ScaleWidth      =   4068
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin VB.TextBox txtItem 
  17.       Height          =   270
  18.       Index           =   1
  19.       Left            =   1560
  20.       TabIndex        =   9
  21.       Top             =   720
  22.       Width           =   2172
  23.    End
  24.    Begin VB.CheckBox chkItem 
  25.       Caption         =   "Check1"
  26.       Height          =   180
  27.       Index           =   2
  28.       Left            =   240
  29.       TabIndex        =   8
  30.       TabStop         =   0   'False
  31.       Top             =   1080
  32.       Width           =   132
  33.    End
  34.    Begin VB.CheckBox chkItem 
  35.       Caption         =   "Check1"
  36.       Height          =   180
  37.       Index           =   1
  38.       Left            =   240
  39.       TabIndex        =   7
  40.       TabStop         =   0   'False
  41.       Top             =   720
  42.       Width           =   132
  43.    End
  44.    Begin VB.ComboBox Combo1 
  45.       Height          =   288
  46.       Left            =   1560
  47.       Style           =   2  'Dropdown List
  48.       TabIndex        =   5
  49.       Top             =   1080
  50.       Width           =   2172
  51.    End
  52.    Begin VB.CheckBox chkItem 
  53.       Caption         =   "Check1"
  54.       Height          =   180
  55.       Index           =   0
  56.       Left            =   240
  57.       TabIndex        =   4
  58.       TabStop         =   0   'False
  59.       Top             =   360
  60.       Value           =   1  'Checked
  61.       Width           =   132
  62.    End
  63.    Begin VB.CommandButton cmdOk 
  64.       Caption         =   "确定 (&O)"
  65.       Default         =   -1  'True
  66.       Height          =   375
  67.       Left            =   720
  68.       TabIndex        =   1
  69.       Top             =   1680
  70.       Width           =   1215
  71.    End
  72.    Begin VB.CommandButton cmdExit 
  73.       Caption         =   "取消 (&X)"
  74.       Height          =   375
  75.       Left            =   2280
  76.       TabIndex        =   2
  77.       Top             =   1680
  78.       Width           =   1215
  79.    End
  80.    Begin VB.TextBox txtItem 
  81.       Height          =   270
  82.       Index           =   0
  83.       Left            =   1560
  84.       TabIndex        =   0
  85.       Top             =   360
  86.       Width           =   2172
  87.    End
  88.    Begin VB.Label lblitem 
  89.       Caption         =   "读者姓名:"
  90.       Height          =   252
  91.       Index           =   2
  92.       Left            =   600
  93.       TabIndex        =   10
  94.       Top             =   720
  95.       Width           =   1092
  96.    End
  97.    Begin VB.Label lblitem 
  98.       Caption         =   "读者种类:"
  99.       Height          =   252
  100.       Index           =   1
  101.       Left            =   600
  102.       TabIndex        =   6
  103.       Top             =   1080
  104.       Width           =   1092
  105.    End
  106.    Begin VB.Label lblitem 
  107.       Caption         =   "读者编号:"
  108.       Height          =   252
  109.       Index           =   0
  110.       Left            =   600
  111.       TabIndex        =   3
  112.       Top             =   360
  113.       Width           =   1092
  114.    End
  115. End
  116. Attribute VB_Name = "frmReader2"
  117. Attribute VB_GlobalNameSpace = False
  118. Attribute VB_Creatable = False
  119. Attribute VB_PredeclaredId = True
  120. Attribute VB_Exposed = False
  121. Option Explicit
  122. '用于传递查询块
  123. Private Sub chkItem_Click(Index As Integer)
  124.     If Index = 0 Then
  125.         txtItem(0).SetFocus
  126.     ElseIf Index = 1 Then
  127.         txtItem(1).SetFocus
  128.     Else
  129.         Combo1.SetFocus
  130.     End If
  131. End Sub
  132. Private Sub cmdExit_Click()
  133.     Me.Hide
  134. End Sub
  135. Private Sub cmdOK_Click()
  136.     Dim sQSql As String
  137.     
  138.     
  139.     If chkItem(0).Value = vbChecked Then
  140.         sQSql = " readerno = '" & Trim(txtItem(0) & " ") & "'"
  141.     End If
  142.     
  143.     
  144.     If chkItem(1).Value = vbChecked Then
  145.         If Trim(sQSql & " ") = "" Then
  146.             sQSql = " readername ='" & Trim(txtItem(1) & " ") & "'"
  147.         Else
  148.             sQSql = sQSql & " and readername ='" & Trim(txtItem(1) & " ") & "'"
  149.         End If
  150.     End If
  151.     
  152.     If chkItem(2).Value = vbChecked Then
  153.         If Trim(sQSql & " ") = "" Then
  154.             sQSql = " readertype ='" & Trim(Combo1 & " ") & "'"
  155.         Else
  156.             sQSql = sQSql & " and readertype ='" & Trim(Combo1 & " ") & "'"
  157.         End If
  158.     End If
  159.     
  160.     If Trim(sQSql) = "" Then
  161.         MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
  162.         Exit Sub
  163.     Else
  164.         If flagRedit Then
  165.             Unload frmReader
  166.         End If
  167.         frmReader.txtSQL = "select * from readers where" & sQSql
  168.         frmReader.Show
  169.     End If
  170.     Me.Hide
  171. End Sub
  172. Private Sub Form_Load()
  173.     
  174.     
  175.     Dim i As Integer
  176.     Dim j As Integer
  177.     Dim sSql As String
  178.     Dim txtSQL As String
  179.     Dim MsgText As String
  180.     Dim mrc As ADODB.Recordset
  181.     
  182.   
  183.     '初始化物资名称
  184.         txtSQL = "select DISTINCT typename from readertype"
  185.         Set mrc = ExecuteSQL(txtSQL, MsgText)
  186.         
  187.         If Not mrc.EOF Then
  188.             
  189.                 Do While Not mrc.EOF
  190.                     Combo1.AddItem Trim(mrc.Fields(0))
  191.                     mrc.MoveNext
  192.                 Loop
  193.                 Combo1.ListIndex = 0
  194.             
  195.         Else
  196.             MsgBox "请先进行读者种类设置!", vbOKOnly + vbExclamation, "警告"
  197.             
  198.             Exit Sub
  199.         End If
  200.         mrc.Close
  201. End Sub
  202. Private Sub lblitem_Click(Index As Integer)
  203.     chkItem(Index).Value = vbChecked
  204.     
  205. End Sub
  206. Private Sub txtItem_GotFocus(Index As Integer)
  207.    
  208.     txtItem(Index).SelStart = 0
  209.     txtItem(Index).SelLength = Len(txtItem(Index))
  210. End Sub