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


VERSION 5.00 
Begin VB.Form frmBookRpt  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "书籍报表" 
   ClientHeight    =   1620 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   4680 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MDIChild        =   -1  'True 
   MinButton       =   0   'False 
   ScaleHeight     =   1620 
   ScaleWidth      =   4680 
   Begin VB.Frame Frame1  
      Height          =   1215 
      Left            =   120 
      TabIndex        =   0 
      Top             =   240 
      Width           =   4455 
      Begin VB.TextBox Text1  
         Height          =   285 
         Left            =   1080 
         MaxLength       =   6 
         TabIndex        =   3 
         Top             =   720 
         Width           =   1575 
      End 
      Begin VB.ComboBox Combo1  
         Height          =   300 
         ItemData        =   "frmBookRpt.frx":0000 
         Left            =   1080 
         List            =   "frmBookRpt.frx":000A 
         TabIndex        =   2 
         Top             =   240 
         Width           =   1815 
      End 
      Begin VB.CommandButton Command1  
         Height          =   495 
         Left            =   3120 
         MouseIcon       =   "frmBookRpt.frx":001A 
         MousePointer    =   99  'Custom 
         Picture         =   "frmBookRpt.frx":016C 
         Style           =   1  'Graphical 
         TabIndex        =   1 
         Top             =   240 
         Width           =   1215 
      End 
      Begin VB.Label Label4  
         Alignment       =   2  'Center 
         BackStyle       =   0  'Transparent 
         Caption         =   "显示" 
         Height          =   255 
         Left            =   3120 
         TabIndex        =   6 
         Top             =   780 
         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           =   615 
      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           =   615 
      End 
   End 
   Begin VB.Label Label3  
      BackStyle       =   0  'Transparent 
      Caption         =   "选择书籍报表条件" 
      Height          =   255 
      Left            =   240 
      TabIndex        =   7 
      Top             =   0 
      Width           =   3375 
   End 
End 
Attribute VB_Name = "frmBookRpt" 
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 Book" 
ElseIf (Combo1.Text = "书号") Then 
        If (Text1.Text <> "") Then 
            If IsNumeric(Text1.Text) Then 
            str = "Select * from Book where Bookid=" & 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 RptBook.DataSource = rs 
RptBook.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