www.pudn.com > cjg2.rar > frmProReading.frm


VERSION 5.00 
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" 
Begin VB.Form ProgramReading  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "程序阅读题题库管理" 
   ClientHeight    =   6465 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   11070 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MDIChild        =   -1  'True 
   MinButton       =   0   'False 
   ScaleHeight     =   6465 
   ScaleWidth      =   11070 
   Begin TabDlg.SSTab SSTab1  
      Height          =   3825 
      Left            =   5228 
      TabIndex        =   1 
      Top             =   480 
      Width           =   5595 
      _ExtentX        =   9869 
      _ExtentY        =   6747 
      _Version        =   393216 
      Style           =   1 
      TabHeight       =   520 
      TabCaption(0)   =   "分题干1" 
      TabPicture(0)   =   "frmProReading.frx":0000 
      Tab(0).ControlEnabled=   -1  'True 
      Tab(0).Control(0)=   "Label5" 
      Tab(0).Control(0).Enabled=   0   'False 
      Tab(0).Control(1)=   "Label3" 
      Tab(0).Control(1).Enabled=   0   'False 
      Tab(0).Control(2)=   "Label4" 
      Tab(0).Control(2).Enabled=   0   'False 
      Tab(0).Control(3)=   "Label2" 
      Tab(0).Control(3).Enabled=   0   'False 
      Tab(0).Control(4)=   "Label9" 
      Tab(0).Control(4).Enabled=   0   'False 
      Tab(0).Control(5)=   "txtD(0)" 
      Tab(0).Control(5).Enabled=   0   'False 
      Tab(0).Control(6)=   "txtC(0)" 
      Tab(0).Control(6).Enabled=   0   'False 
      Tab(0).Control(7)=   "txtB(0)" 
      Tab(0).Control(7).Enabled=   0   'False 
      Tab(0).Control(8)=   "txtA(0)" 
      Tab(0).Control(8).Enabled=   0   'False 
      Tab(0).Control(9)=   "txtDiv(0)" 
      Tab(0).Control(9).Enabled=   0   'False 
      Tab(0).Control(10)=   "Frame1" 
      Tab(0).Control(10).Enabled=   0   'False 
      Tab(0).ControlCount=   11 
      TabCaption(1)   =   "分题干2" 
      TabPicture(1)   =   "frmProReading.frx":001C 
      Tab(1).ControlEnabled=   0   'False 
      Tab(1).Control(0)=   "Label11" 
      Tab(1).Control(1)=   "Label12" 
      Tab(1).Control(2)=   "Label13" 
      Tab(1).Control(3)=   "Label14" 
      Tab(1).Control(4)=   "Label15" 
      Tab(1).Control(5)=   "txtD(1)" 
      Tab(1).Control(6)=   "txtC(1)" 
      Tab(1).Control(7)=   "txtB(1)" 
      Tab(1).Control(8)=   "txtA(1)" 
      Tab(1).Control(9)=   "txtDiv(1)" 
      Tab(1).Control(10)=   "Frame2" 
      Tab(1).ControlCount=   11 
      TabCaption(2)   =   "分题干3" 
      TabPicture(2)   =   "frmProReading.frx":0038 
      Tab(2).ControlEnabled=   0   'False 
      Tab(2).Control(0)=   "Label17" 
      Tab(2).Control(1)=   "Label18" 
      Tab(2).Control(2)=   "Label19" 
      Tab(2).Control(3)=   "Label20" 
      Tab(2).Control(4)=   "Label21" 
      Tab(2).Control(5)=   "txtD(2)" 
      Tab(2).Control(6)=   "txtC(2)" 
      Tab(2).Control(7)=   "txtB(2)" 
      Tab(2).Control(8)=   "txtA(2)" 
      Tab(2).Control(9)=   "txtDiv(2)" 
      Tab(2).Control(10)=   "Frame3" 
      Tab(2).ControlCount=   11 
      Begin VB.Frame Frame3  
         Caption         =   "参考答案" 
         Height          =   555 
         Left            =   -74535 
         TabIndex        =   57 
         Top             =   3105 
         Width           =   3450 
         Begin VB.OptionButton optA  
            Caption         =   "A" 
            Height          =   180 
            Index           =   2 
            Left            =   810 
            TabIndex        =   61 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optB  
            Caption         =   "B" 
            Height          =   180 
            Index           =   2 
            Left            =   1260 
            TabIndex        =   60 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optD  
            Caption         =   "D" 
            Height          =   180 
            Index           =   2 
            Left            =   2175 
            TabIndex        =   59 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optC  
            Caption         =   "C" 
            Height          =   180 
            Index           =   2 
            Left            =   1710 
            TabIndex        =   58 
            Top             =   240 
            Width           =   420 
         End 
      End 
      Begin VB.Frame Frame2  
         Caption         =   "参考答案" 
         Height          =   555 
         Left            =   -74505 
         TabIndex        =   52 
         Top             =   3120 
         Width           =   3450 
         Begin VB.OptionButton optA  
            Caption         =   "A" 
            Height          =   180 
            Index           =   1 
            Left            =   810 
            TabIndex        =   56 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optB  
            Caption         =   "B" 
            Height          =   180 
            Index           =   1 
            Left            =   1260 
            TabIndex        =   55 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optD  
            Caption         =   "D" 
            Height          =   180 
            Index           =   1 
            Left            =   2175 
            TabIndex        =   54 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optC  
            Caption         =   "C" 
            Height          =   180 
            Index           =   1 
            Left            =   1710 
            TabIndex        =   53 
            Top             =   240 
            Width           =   420 
         End 
      End 
      Begin VB.Frame Frame1  
         Caption         =   "参考答案" 
         Height          =   555 
         Left            =   435 
         TabIndex        =   47 
         Top             =   3150 
         Width           =   3450 
         Begin VB.OptionButton optC  
            Caption         =   "C" 
            Height          =   180 
            Index           =   0 
            Left            =   1710 
            TabIndex        =   51 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optD  
            Caption         =   "D" 
            Height          =   180 
            Index           =   0 
            Left            =   2175 
            TabIndex        =   50 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optB  
            Caption         =   "B" 
            Height          =   180 
            Index           =   0 
            Left            =   1260 
            TabIndex        =   49 
            Top             =   240 
            Width           =   420 
         End 
         Begin VB.OptionButton optA  
            Caption         =   "A" 
            Height          =   180 
            Index           =   0 
            Left            =   810 
            TabIndex        =   48 
            Top             =   240 
            Width           =   420 
         End 
      End 
      Begin VB.TextBox txtDiv  
         Height          =   825 
         Index           =   2 
         Left            =   -74520 
         MaxLength       =   1000 
         MultiLine       =   -1  'True 
         TabIndex        =   12 
         Top             =   720 
         Width           =   4785 
      End 
      Begin VB.TextBox txtA  
         Height          =   270 
         Index           =   2 
         Left            =   -73920 
         MaxLength       =   50 
         TabIndex        =   13 
         Top             =   1650 
         Width           =   4185 
      End 
      Begin VB.TextBox txtB  
         Height          =   270 
         Index           =   2 
         Left            =   -73920 
         MaxLength       =   50 
         TabIndex        =   14 
         Top             =   1995 
         Width           =   4185 
      End 
      Begin VB.TextBox txtC  
         Height          =   270 
         Index           =   2 
         Left            =   -73920 
         MaxLength       =   50 
         TabIndex        =   15 
         Top             =   2355 
         Width           =   4185 
      End 
      Begin VB.TextBox txtD  
         Height          =   270 
         Index           =   2 
         Left            =   -73920 
         MaxLength       =   50 
         TabIndex        =   16 
         Top             =   2700 
         Width           =   4185 
      End 
      Begin VB.TextBox txtDiv  
         Height          =   825 
         Index           =   1 
         Left            =   -74520 
         MaxLength       =   1000 
         MultiLine       =   -1  'True 
         TabIndex        =   7 
         Top             =   735 
         Width           =   4785 
      End 
      Begin VB.TextBox txtA  
         Height          =   270 
         Index           =   1 
         Left            =   -73905 
         MaxLength       =   50 
         TabIndex        =   8 
         Top             =   1650 
         Width           =   4185 
      End 
      Begin VB.TextBox txtB  
         Height          =   270 
         Index           =   1 
         Left            =   -73905 
         MaxLength       =   50 
         TabIndex        =   9 
         Top             =   1995 
         Width           =   4185 
      End 
      Begin VB.TextBox txtC  
         Height          =   270 
         Index           =   1 
         Left            =   -73905 
         MaxLength       =   50 
         TabIndex        =   10 
         Top             =   2355 
         Width           =   4185 
      End 
      Begin VB.TextBox txtD  
         Height          =   270 
         Index           =   1 
         Left            =   -73905 
         MaxLength       =   50 
         TabIndex        =   11 
         Top             =   2700 
         Width           =   4185 
      End 
      Begin VB.TextBox txtDiv  
         Height          =   825 
         Index           =   0 
         Left            =   450 
         MaxLength       =   1000 
         MultiLine       =   -1  'True 
         TabIndex        =   2 
         Top             =   735 
         Width           =   4785 
      End 
      Begin VB.TextBox txtA  
         Height          =   270 
         Index           =   0 
         Left            =   1065 
         MaxLength       =   50 
         TabIndex        =   3 
         Top             =   1665 
         Width           =   4185 
      End 
      Begin VB.TextBox txtB  
         Height          =   270 
         Index           =   0 
         Left            =   1065 
         MaxLength       =   50 
         TabIndex        =   4 
         Top             =   2010 
         Width           =   4185 
      End 
      Begin VB.TextBox txtC  
         Height          =   270 
         Index           =   0 
         Left            =   1080 
         MaxLength       =   50 
         TabIndex        =   5 
         Top             =   2355 
         Width           =   4185 
      End 
      Begin VB.TextBox txtD  
         Height          =   270 
         Index           =   0 
         Left            =   1065 
         MaxLength       =   50 
         TabIndex        =   6 
         Top             =   2715 
         Width           =   4185 
      End 
      Begin VB.Label Label21  
         AutoSize        =   -1  'True 
         Caption         =   "选项A" 
         Height          =   180 
         Left            =   -74535 
         TabIndex        =   46 
         Top             =   1695 
         Width           =   450 
      End 
      Begin VB.Label Label20  
         AutoSize        =   -1  'True 
         Caption         =   "题干内容" 
         Height          =   180 
         Left            =   -74535 
         TabIndex        =   45 
         Top             =   495 
         Width           =   720 
      End 
      Begin VB.Label Label19  
         AutoSize        =   -1  'True 
         Caption         =   "选项C" 
         Height          =   180 
         Left            =   -74535 
         TabIndex        =   44 
         Top             =   2400 
         Width           =   450 
      End 
      Begin VB.Label Label18  
         AutoSize        =   -1  'True 
         Caption         =   "选项B" 
         Height          =   180 
         Left            =   -74535 
         TabIndex        =   43 
         Top             =   2040 
         Width           =   450 
      End 
      Begin VB.Label Label17  
         AutoSize        =   -1  'True 
         Caption         =   "选项D" 
         Height          =   180 
         Left            =   -74535 
         TabIndex        =   42 
         Top             =   2745 
         Width           =   450 
      End 
      Begin VB.Label Label15  
         AutoSize        =   -1  'True 
         Caption         =   "选项A" 
         Height          =   180 
         Left            =   -74520 
         TabIndex        =   41 
         Top             =   1695 
         Width           =   450 
      End 
      Begin VB.Label Label14  
         AutoSize        =   -1  'True 
         Caption         =   "题干内容" 
         Height          =   180 
         Left            =   -74520 
         TabIndex        =   40 
         Top             =   495 
         Width           =   720 
      End 
      Begin VB.Label Label13  
         AutoSize        =   -1  'True 
         Caption         =   "选项C" 
         Height          =   180 
         Left            =   -74520 
         TabIndex        =   39 
         Top             =   2400 
         Width           =   450 
      End 
      Begin VB.Label Label12  
         AutoSize        =   -1  'True 
         Caption         =   "选项B" 
         Height          =   180 
         Left            =   -74520 
         TabIndex        =   38 
         Top             =   2040 
         Width           =   450 
      End 
      Begin VB.Label Label11  
         AutoSize        =   -1  'True 
         Caption         =   "选项D" 
         Height          =   180 
         Left            =   -74520 
         TabIndex        =   37 
         Top             =   2745 
         Width           =   450 
      End 
      Begin VB.Label Label9  
         AutoSize        =   -1  'True 
         Caption         =   "选项A" 
         Height          =   180 
         Left            =   450 
         TabIndex        =   36 
         Top             =   1695 
         Width           =   450 
      End 
      Begin VB.Label Label2  
         AutoSize        =   -1  'True 
         Caption         =   "题干内容" 
         Height          =   180 
         Left            =   450 
         TabIndex        =   35 
         Top             =   495 
         Width           =   720 
      End 
      Begin VB.Label Label4  
         AutoSize        =   -1  'True 
         Caption         =   "选项C" 
         Height          =   180 
         Left            =   450 
         TabIndex        =   34 
         Top             =   2400 
         Width           =   450 
      End 
      Begin VB.Label Label3  
         AutoSize        =   -1  'True 
         Caption         =   "选项B" 
         Height          =   180 
         Left            =   450 
         TabIndex        =   33 
         Top             =   2040 
         Width           =   450 
      End 
      Begin VB.Label Label5  
         AutoSize        =   -1  'True 
         Caption         =   "选项D" 
         Height          =   180 
         Left            =   450 
         TabIndex        =   32 
         Top             =   2745 
         Width           =   450 
      End 
   End 
   Begin VB.TextBox txtPoint  
      Height          =   270 
      Left            =   6113 
      MaxLength       =   1 
      TabIndex        =   17 
      Text            =   "3" 
      Top             =   4455 
      Width           =   630 
   End 
   Begin VB.TextBox txtParse  
      Height          =   630 
      Left            =   5228 
      MaxLength       =   300 
      MultiLine       =   -1  'True 
      ScrollBars      =   2  'Vertical 
      TabIndex        =   18 
      Top             =   5055 
      Width           =   5595 
   End 
   Begin VB.TextBox txtQuestion  
      Height          =   5205 
      Left            =   248 
      MaxLength       =   1000 
      MultiLine       =   -1  'True 
      ScrollBars      =   3  'Both 
      TabIndex        =   0 
      Top             =   480 
      Width           =   4680 
   End 
   Begin VB.CommandButton cmdSave  
      Caption         =   "保存" 
      Height          =   300 
      Left            =   5543 
      TabIndex        =   21 
      Top             =   5790 
      Width           =   735 
   End 
   Begin VB.CommandButton cmdExit  
      Cancel          =   -1  'True 
      Caption         =   "退出" 
      Height          =   300 
      Left            =   6278 
      TabIndex        =   22 
      Top             =   5790 
      Width           =   735 
   End 
   Begin VB.CommandButton cmdDelete  
      Caption         =   "删除" 
      Height          =   300 
      Left            =   4793 
      TabIndex        =   20 
      Top             =   5790 
      Width           =   735 
   End 
   Begin VB.CommandButton cmdAdd  
      Caption         =   "添加" 
      Height          =   300 
      Left            =   4058 
      TabIndex        =   19 
      Top             =   5790 
      Width           =   735 
   End 
   Begin VB.PictureBox picNavigation  
      AutoSize        =   -1  'True 
      BorderStyle     =   0  'None 
      Height          =   330 
      Left            =   4463 
      ScaleHeight     =   330 
      ScaleWidth      =   2415 
      TabIndex        =   27 
      Top             =   6105 
      Width           =   2410 
      Begin VB.CommandButton cmdMove  
         Height          =   270 
         Index           =   1 
         Left            =   285 
         Picture         =   "frmProReading.frx":0054 
         Style           =   1  'Graphical 
         TabIndex        =   24 
         Top             =   0 
         Width           =   300 
      End 
      Begin VB.CommandButton cmdMove  
         Height          =   270 
         Index           =   0 
         Left            =   -15 
         Picture         =   "frmProReading.frx":0098 
         Style           =   1  'Graphical 
         TabIndex        =   23 
         Top             =   0 
         Width           =   300 
      End 
      Begin VB.CommandButton cmdMove  
         Height          =   270 
         Index           =   3 
         Left            =   2010 
         Picture         =   "frmProReading.frx":00E5 
         Style           =   1  'Graphical 
         TabIndex        =   26 
         Top             =   -15 
         Width           =   300 
      End 
      Begin VB.CommandButton cmdMove  
         Height          =   270 
         Index           =   2 
         Left            =   1725 
         Picture         =   "frmProReading.frx":0131 
         Style           =   1  'Graphical 
         TabIndex        =   25 
         Top             =   -15 
         Width           =   300 
      End 
      Begin VB.TextBox txtNews  
         Height          =   270 
         Left            =   555 
         Locked          =   -1  'True 
         TabIndex        =   28 
         TabStop         =   0   'False 
         Top             =   0 
         Width           =   1185 
      End 
   End 
   Begin VB.Label Label8  
      AutoSize        =   -1  'True 
      Caption         =   "试题解析" 
      Height          =   180 
      Left            =   5228 
      TabIndex        =   31 
      Top             =   4830 
      Width           =   720 
   End 
   Begin VB.Label Label7  
      AutoSize        =   -1  'True 
      Caption         =   "参考分数" 
      Height          =   180 
      Left            =   5228 
      TabIndex        =   30 
      Top             =   4500 
      Width           =   720 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "程序代码" 
      Height          =   180 
      Left            =   263 
      TabIndex        =   29 
      Top             =   210 
      Width           =   720 
   End 
End 
Attribute VB_Name = "ProgramReading" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
Dim isAdding As Boolean             '定义操作状态标志 
Dim objProReading As Recordset      '用于保存程序阅读题数据表记录 
Dim objCn As Connection             '用于建立数据库联接 
 
Private Sub cmdExit_Click() 
    Unload Me               '关闭程序阅读题管理窗体 
End Sub 
 
Private Sub Form_Load() 
    '建立数据库联接 
    Set objCn = New Connection                 '实例化联接对象 
    With objCn                                 '建立数据库联接 
        .Provider = "SQLOLEDB" 
        .ConnectionString = "User ID=sa;PWD=123;Data Source=(local);Initial Catalog=自测考试" 
        .Open 
    End With 
    '获取程序阅读题记录 
    Set objProReading = New Recordset                 '实例化objProReading对象 
    With objProReading 
        Set .ActiveConnection = objCn 
        .CursorLocation = adUseClient           '指定使用客户端游标 
        .CursorType = adOpenStatic              '指定使用静态游标 
        .LockType = adLockOptimistic 
        .Open "SELECT * FROM 程序阅读"          '获取程序阅读题数据 
    End With 
    cmdMove(0).Value = True                     '触发按钮单击事件,显示第一个记录 
End Sub 
 
Private Sub cmdMove_Click(Index As Integer) 
    With objProReading 
        Select Case Index           '切换当前记录 
            Case 0                  '使第一个记录成为当前记录 
                If .RecordCount > 0 And Not .BOF Then .MoveFirst 
            Case 1                  '使上一个记录成为当前记录 
                If .RecordCount > 0 And Not .BOF Then 
                    .MovePrevious 
                    If .BOF Then .MoveFirst 
                End If 
            Case 2                  '使下一个记录成为当前记录 
                If .RecordCount > 0 And Not .EOF Then 
                    .MoveNext 
                    If .EOF Then .MoveLast 
                End If 
            Case 3                  '使最后一个记录成为当前记录 
                If .RecordCount > 0 And Not .EOF Then .MoveLast 
        End Select 
        Show_Data 
    End With 
    If isAdding Then isAdding = False 
End Sub 
 
Private Sub cmdAdd_Click() 
    Dim i% 
    txtNews = "添加新记录" 
    txtQuestion = "" 
    For i = 0 To 2 
        txtDiv(i) = "": txtA(i) = "": txtB(i) = "" 
        txtC(i) = "": txtD(i) = "" 
        optA(i) = True 
    Next 
    txtPoint = "3": txtParse = "" 
    isAdding = True 
    txtQuestion.SetFocus 
    SSTab1.Tab = 0                                  '显示分题干1选项卡 
End Sub 
 
Private Sub cmdDelete_Click() 
    '根据是否处于添加记录状态执行不同的操作 
    If isAdding Then                '退出添加记录状态,显示当前记录 
        isAdding = False 
        If objProReading.RecordCount <= 0 Then 
            txtNews = "记录:无"    '显示无记录提示 
        Else 
            Show_Data               '显示当前记录数据 
        End If 
    Else 
        If objProReading.RecordCount > 0 Then 
            If MsgBox("是否删除当前记录?", vbYesNo + vbQuestion, _ 
                       "程序阅读题管理") = vbYes Then 
                objProReading.Delete            '执行删除当前记录操作 
                cmdMove(2).Value = True         '显示下一记录数据 
            Else 
                Show_Data                       '显示当前记录数据 
            End If 
        End If 
    End If 
End Sub 
Private Sub cmdSave_Click() 
    Dim objCopy As New Recordset, i% 
    '在当前表中无数据和不是添加记录时,不执行保存操作 
    If Not isAdding And objProReading.RecordCount < 1 Then Exit Sub 
    '检查是否输入程序阅读题程序代码 
    If Trim(txtQuestion) = "" Then 
        MsgBox "请输入程序阅读题程序代码!", vbCritical, "程序阅读题管理" 
        txtQuestion.SetFocus: txtQuestion = "" 
        Exit Sub 
    End If 
    '检查是否输入必须的分题干1及其选项 
    If Trim(txtDiv(0)) = "" And i = 0 Then 
        MsgBox "请输入分题干1!", vbCritical, "程序阅读题管理" 
        SSTab1.Tab = 0 
        txtDiv(0).SetFocus: txtDiv(0) = "" 
        Exit Sub 
    Else 
        If Trim(txtA(0)) = "" Then 
            MsgBox "请输入分题干1选项A!", vbCritical, "程序阅读题管理" 
            SSTab1.Tab = 0 
            txtA(0).SetFocus: txtA(0) = "" 
            Exit Sub 
        ElseIf Trim(txtB(0)) = "" Then 
            MsgBox "请输入分题干1选项B!", vbCritical, "程序阅读题管理" 
            SSTab1.Tab = 0 
            txtB(0).SetFocus: txtB(0) = "" 
            Exit Sub 
        ElseIf Trim(txtC(0)) = "" Then 
            MsgBox "请输入分题干1选项C!", vbCritical, "程序阅读题管理" 
            SSTab1.Tab = 0 
            txtC(0).SetFocus: txtC(0) = "" 
            Exit Sub 
        ElseIf Trim(txtD(0)) = "" Then 
            MsgBox "请输入分题干1选项D!", vbCritical, "程序阅读题管理" 
            SSTab1.Tab = 0 
            txtD(0).SetFocus: txtD(0) = "" 
            Exit Sub 
        End If 
    End If 
    '检查是否输入分题干2、3及其选项 
    For i = 1 To 2 
        If Trim(txtDiv(i)) <> "" Then 
            If Trim(txtA(i)) = "" Then 
                MsgBox "请输入分题干" & Trim(Str(i + 1)) & "选项A!", vbCritical, "程序阅读题管理" 
                SSTab1.Tab = i 
                txtA(i).SetFocus: txtA(i) = "" 
                Exit Sub 
            ElseIf Trim(txtB(i)) = "" Then 
                MsgBox "请输入分题干" & Trim(Str(i + 1)) & "选项B!", vbCritical, "程序阅读题管理" 
                SSTab1.Tab = i 
                txtB(i).SetFocus: txtB(i) = "" 
                Exit Sub 
            ElseIf Trim(txtC(i)) = "" Then 
                MsgBox "请输入分题干" & Trim(Str(i + 1)) & "选项C!", vbCritical, "程序阅读题管理" 
                SSTab1.Tab = i 
                txtC(i).SetFocus: txtC(i) = "" 
                Exit Sub 
            ElseIf Trim(txtD(i)) = "" Then 
                MsgBox "请输入分题干" & Trim(Str(i + 1)) & "选项D!", vbCritical, "程序阅读题管理" 
                SSTab1.Tab = i 
                txtD(i).SetFocus: txtD(i) = "" 
                Exit Sub 
            End If 
        End If 
    Next 
    If Not txtPoint Like "[1-9]" Then 
        MsgBox "请输入有效的分数!", vbCritical, "程序阅读题管理" 
        txtPoint.SetFocus 
        txtPoint.SelStart = 0: txtPoint.SelLength = Len(txtPoint) 
        Exit Sub 
    End If 
    Set objCopy = objProReading.Clone 
    With objCopy 
        If .RecordCount > 0 Then 
            '检查程序阅读题是否重复 
            .MoveFirst 
            .Find "题干='" & Trim(txtQuestion) & "'" 
            If (isAdding And Not .EOF) Or _ 
                (Not isAdding And Not .EOF And _ 
                 .AbsolutePosition <> objProReading.AbsolutePosition) Then 
                MsgBox "试题重复,请修改!", vbCritical, "程序阅读题管理" 
                txtQuestion.SetFocus 
                txtQuestion.SelStart = 0 
                txtQuestion.SelLength = Len(txtQuestion) 
                Exit Sub 
            End If 
        End If 
        '保存或添加新记录 
        If isAdding Then objProReading.AddNew 
        objProReading.Fields("题干") = Trim(txtQuestion) 
        objProReading.Fields("分题干1") = Trim(txtDiv(0)) 
        objProReading.Fields("选项1a") = Trim(txtA(0)) 
        objProReading.Fields("选项1b") = Trim(txtB(0)) 
        objProReading.Fields("选项1c") = Trim(txtC(0)) 
        objProReading.Fields("选项1d") = Trim(txtD(0)) 
        objProReading.Fields("答案1") = Switch(optA(0), "A", optB(0), "B", optC(0), "C", optD(0), "D") 
        For i = 1 To 2 
            If txtDiv(i) <> "" Then 
                objProReading.Fields("分题干" & Trim(Str(i + 1)) & "") = Trim(txtDiv(i)) 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "a") = Trim(txtA(i)) 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "b") = Trim(txtB(i)) 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "c") = Trim(txtC(i)) 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "d") = Trim(txtD(i)) 
                objProReading.Fields("答案" & Trim(Str(i + 1)) & "") = Switch(optA(i), "A", optB(i), "B", optC(i), "C", optD(i), "D") 
            Else 
                objProReading.Fields("分题干" & Trim(Str(i + 1)) & "") = "" 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "a") = "" 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "b") = "" 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "c") = "" 
                objProReading.Fields("选项" & Trim(Str(i + 1)) & "d") = "" 
                objProReading.Fields("答案" & Trim(Str(i + 1)) & "") = "" 
            End If 
        Next 
        objProReading.Fields("分数") = Trim(txtPoint) 
        objProReading.Fields("解析") = Trim(txtParse) 
        objProReading.Update 
        MsgBox "数据保存成功!", vbInformation, "程序阅读题管理" 
        isAdding = False 
        '显示当前记录编号和记录总数 
        txtNews = "记录:" & objProReading.AbsolutePosition & "/" & objProReading.RecordCount 
    End With 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
    objCn.Close                 '关闭数据联接 
    Set objCn = Nothing         '释放数据库联接 
    Set objProReading = Nothing      '释放记录集对象 
End Sub 
 
'限制分数输入 
Private Sub txtPoint_KeyPress(KeyAscii As Integer) 
    If Not (Chr(KeyAscii) Like "[1-9]" Or KeyAscii = vbKeyBack) Then 
        KeyAscii = 0    '输入不是数字或退格键,取消输入 
    End If 
End Sub 
 
Private Sub Show_Data() 
    Dim i% 
    With objProReading 
        If .RecordCount < 1 Then 
            txtNews = "记录:无"    '显示无记录提示 
            '清除显示数据 
            txtQuestion = "": txtPoint = "": txtParse = "" 
            For i = 0 To 2 
                txtDiv(i) = "": txtA(i) = "": txtB(i) = "" 
                txtC(i) = "": txtD(i) = "": optA(i) = True 
            Next 
        Else 
            '显示当前记录数据 
            txtQuestion = .Fields("题干") 
            txtPoint = .Fields("分数") 
            txtParse = .Fields("解析") 
            For i = 0 To 2 
                txtDiv(i) = .Fields("分题干" & Trim(Str(i + 1))) 
                txtA(i) = .Fields("选项" & Trim(Str(i + 1)) & "a") 
                txtB(i) = .Fields("选项" & Trim(Str(i + 1)) & "b") 
                txtC(i) = .Fields("选项" & Trim(Str(i + 1)) & "c") 
                txtD(i) = .Fields("选项" & Trim(Str(i + 1)) & "d") 
                Select Case .Fields("答案" & Trim(Str(i + 1))) 
                    Case "A" 
                        optA(i) = True 
                    Case "B" 
                        optB(i) = True 
                    Case "C" 
                        optC(i) = True 
                    Case "D" 
                        optD(i) = True 
                End Select 
            Next 
            '显示当前记录编号和记录总数 
            txtNews = "记录:" & .AbsolutePosition & "/" & .RecordCount 
        End If 
    End With 
    SSTab1.Tab = 0 
End Sub