www.pudn.com > opy_LMS.rar > frmMembersRpt.frm


VERSION 5.00 
Begin VB.Form frmMembersRpt  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "读者报表" 
   ClientHeight    =   1695 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   5220 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MDIChild        =   -1  'True 
   MinButton       =   0   'False 
   ScaleHeight     =   1695 
   ScaleWidth      =   5220 
   Begin VB.Frame Frame1  
      Height          =   1215 
      Left            =   120 
      TabIndex        =   0 
      Top             =   240 
      Width           =   4935 
      Begin VB.CommandButton Command1  
         Height          =   495 
         Left            =   3480 
         MouseIcon       =   "frmMembersRpt.frx":0000 
         MousePointer    =   99  'Custom 
         Picture         =   "frmMembersRpt.frx":0152 
         Style           =   1  'Graphical 
         TabIndex        =   3 
         Top             =   240 
         Width           =   1215 
      End 
      Begin VB.ComboBox Combo1  
         Height          =   300 
         ItemData        =   "frmMembersRpt.frx":05DD 
         Left            =   1440 
         List            =   "frmMembersRpt.frx":05E7 
         TabIndex        =   2 
         Top             =   240 
         Width           =   1815 
      End 
      Begin VB.TextBox Text1  
         Height          =   285 
         Left            =   1440 
         MaxLength       =   6 
         TabIndex        =   1 
         Top             =   720 
         Width           =   1575 
      End 
      Begin VB.Label Label4  
         Alignment       =   2  'Center 
         BackStyle       =   0  'Transparent 
         Caption         =   "显示" 
         Height          =   255 
         Left            =   3480 
         TabIndex        =   6 
         Top             =   765 
         Width           =   1215 
      End 
      Begin VB.Label Label2  
         BackStyle       =   0  'Transparent 
         Caption         =   "借书证号" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   9.75 
            Charset         =   0 
            Weight          =   700 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00800000& 
         Height          =   255 
         Left            =   120 
         TabIndex        =   5 
         Top             =   720 
         Width           =   1335 
      End 
      Begin VB.Label Label1  
         BackStyle       =   0  'Transparent 
         Caption         =   "字段" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   9.75 
            Charset         =   0 
            Weight          =   700 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00800000& 
         Height          =   255 
         Left            =   120 
         TabIndex        =   4 
         Top             =   240 
         Width           =   735 
      End 
   End 
   Begin VB.Label Label3  
      BackStyle       =   0  'Transparent 
      Caption         =   "选择读者报表条件" 
      Height          =   255 
      Left            =   240 
      TabIndex        =   7 
      Top             =   0 
      Width           =   4575 
   End 
End 
Attribute VB_Name = "frmMembersRpt" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim rs As ADODB.Recordset 
Dim db As ADODB.Connection 
Dim status As Boolean 
Dim str As String 
Private Sub Combo1_Click() 
If (Combo1.Text = "所有") Then 
Text1.Text = "" 
Text1.Locked = True 
ElseIf (Combo1.Text = "借书证号") Then 
Text1.Text = "" 
Text1.Locked = False 
End If 
End Sub 
Private Sub Command1_Click() 
If (Combo1.Text <> "所有" And Combo1.Text <> "借书证号") Then 
 MsgBox "请选择适当的读者字段选项.", vbCritical, "错误信息" 
Exit Sub 
End If 
 
If (Combo1.Text = "所有") Then 
str = "Select * from member" 
ElseIf (Combo1.Text = "借书证号") Then 
        If (Text1.Text <> "") Then 
            If IsNumeric(Text1.Text) Then 
            str = "Select * from member where Memid=" & Text1.Text 
            Else 
            MsgBox ("请输入为数字的借书证号."), vbExclamation, "错误信息" 
            Exit Sub 
            End If 
        Else 
        MsgBox ("请输入借书证号."), vbExclamation, "错误信息" 
        Exit Sub 
        End If 
End If 
again: 
If (status = False) Then 
rs.Open str, db, adOpenStatic, adLockOptimistic 
status = True 
Else 
rs.Close 
status = False 
GoTo again 
End If 
Set RptMembers.DataSource = rs 
RptMembers.Show vbModal 
End Sub 
Private Sub Form_Load() 
Set db = New ADODB.Connection 
Set rs = New ADODB.Recordset 
db.CursorLocation = adUseClient 
db.ConnectionString = "DSN=library;UID=sa;PWD=;" 
db.Open 
status = False 
End Sub