VERSION 5.00
Begin VB.Form addcase 
   Caption         =   "添加案例"
   ClientHeight    =   5250
   ClientLeft      =   60
   ClientTop       =   285
   ClientWidth     =   8055
   LinkTopic       =   "Form1"
   ScaleHeight     =   5250
   ScaleWidth      =   8055
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Combo5 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   1800
      TabIndex        =   20
      Top             =   1950
      Width           =   1455
   End
   Begin VB.ComboBox Combo4 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   1800
      TabIndex        =   18
      Top             =   1365
      Width           =   1395
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3390
      TabIndex        =   16
      Top             =   4680
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1800
      TabIndex        =   15
      Top             =   4680
      Width           =   855
   End
   Begin VB.TextBox Text5 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1155
      Left            =   360
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   14
      Top             =   3360
      Width           =   7335
   End
   Begin VB.ComboBox Combo3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   5040
      TabIndex        =   11
      Top             =   2520
      Width           =   795
   End
   Begin VB.ComboBox Combo2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   3540
      TabIndex        =   9
      Top             =   2520
      Width           =   795
   End
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   1800
      TabIndex        =   7
      Top             =   2520
      Width           =   1215
   End
   Begin VB.TextBox Text4 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   6120
      TabIndex        =   5
      Top             =   780
      Width           =   1575
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1800
      TabIndex        =   4
      Top             =   780
      Width           =   3015
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   6120
      TabIndex        =   2
      Top             =   195
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1800
      TabIndex        =   1
      Top             =   195
      Width           =   3015
   End
   Begin VB.CommandButton Command1 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5040
      TabIndex        =   0
      Top             =   4680
      Width           =   855
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "案        号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   300
      TabIndex        =   27
      Top             =   240
      Width           =   1275
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "案    由"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   4980
      TabIndex        =   26
      Top             =   240
      Width           =   855
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "审理法院"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   4980
      TabIndex        =   25
      Top             =   825
      Width           =   855
   End
   Begin VB.Label Label12 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "法官姓名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   5340
      TabIndex        =   24
      Top             =   1410
      Width           =   855
   End
   Begin VB.Label Label14 
      AutoSize        =   -1  'True
      Caption         =   "律师姓名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   5340
      TabIndex        =   23
      Top             =   1995
      Width           =   840
   End
   Begin VB.Label Label15 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   6360
      TabIndex        =   22
      Top             =   1980
      Width           =   1095
   End
   Begin VB.Label Label13 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   6360
      TabIndex        =   21
      Top             =   1395
      Width           =   1095
   End
   Begin VB.Label Label11 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "辩护律师编号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   300
      TabIndex        =   19
      Top             =   1995
      Width           =   1275
   End
   Begin VB.Label Label10 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "执行法官编号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   300
      TabIndex        =   17
      Top             =   1410
      Width           =   1275
   End
   Begin VB.Label Label9 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "案件事实"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   2880
      TabIndex        =   13
      Top             =   3000
      Width           =   855
   End
   Begin VB.Label Label8 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "日"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   6060
      TabIndex        =   12
      Top             =   2580
      Width           =   225
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "月"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   4560
      TabIndex        =   10
      Top             =   2580
      Width           =   225
   End
   Begin VB.Label Label6 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "年"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   3120
      TabIndex        =   8
      Top             =   2580
      Width           =   225
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "审 判  时 间"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   300
      TabIndex        =   6
      Top             =   2580
      Width           =   1275
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "当   事   人"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   300
      TabIndex        =   3
      Top             =   825
      Width           =   1275
   End
End
Attribute VB_Name = "addcase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Combo4_click()      ' 编号列表
Dim rs As New ADODB.Recordset
  Dim sql As String
  sql = "SELECT 姓名 FROM judgeInformation WHERE 编号='" & Combo4.Text & "';"
       Set rs = TransactSQL(sql)
        If rs.EOF = False Then
           rs.MoveFirst
            While Not rs.EOF
                Label13.Caption = rs(0)
                rs.MoveNext
            Wend
            rs.Close
        End If
End Sub

Private Sub Combo5_click()
Dim rs As New ADODB.Recordset
  Dim sql As String
  sql = "SELECT 姓名 FROM lawyerInformation WHERE 编号='" & Combo5.Text & "';"
       Set rs = TransactSQL(sql)
        If rs.EOF = False Then
           rs.MoveFirst
            While Not rs.EOF
                Label15.Caption = rs(0)
                rs.MoveNext
            Wend
            rs.Close
        End If
End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()     '添加记录
Dim rs As New ADODB.Recordset
Dim sql, sql1, sql2 As String
        If flag = 1 And Trim(Text1.Text) = "" Then
           MsgBox "请输入案号", vbOKOnly + vbExclamation, ""
           Text1.SetFocus
        ElseIf flag = 1 And Trim(Text1.Text) <> "" Then
               sql = "select * from caseInformation where 案号='" & Text1.Text & "'"
               Set rs = TransactSQL(sql)
            If rs.EOF = False Then
                MsgBox "此案号已经存在，请更换！", vbOKOnly + vbExclamation, ""
                Text1.Text = ""
                Text1.SetFocus
           Else
                sql1 = "select * from caseInformation where 案号='" & Combo4.Text & "'"
                Set rs = TransactSQL(sql1)
                Call addNewRecord
                MsgBox "添加成功！", vbOKOnly + vbExclamation, "添加结果！"
                 Call init
            End If
  Else
        Call uprecord
 End If
End Sub

Private Sub Command3_Click()  '删除记录
 If MsgBox("真的要删除这条记录么？", vbOKCancel + vbExclamation, "提示！") = vbOK Then
     ingid.Delete
     MsgBox "案例信息已经删除！", vbOKOnly + vbExclamation, "警告!"
     Unload Me
 End If
End Sub


Private Sub Form_Load()
    Dim j As String
    Dim i As Integer
    Dim sql, sql1 As String
    Dim rs As New ADODB.Recordset
    Dim num As Integer
    Dim temp, temp1, temp2 As String
    j = Date
         For i = 1980 To Left(j, 4)        '设置年
            Me.Combo1.AddItem i
        Next i
        Me.Combo1.ListIndex = 0
        For i = 1 To 12                    '设置月
            temp1 = Right(Format(100 + i), 2)
            Me.Combo2.AddItem temp1
        Next i
        Me.Combo2.ListIndex = 0
        For i = 1 To 31                    '设置日
            temp2 = Right(Format(100 + i), 2)
            Me.Combo3.AddItem temp2
        Next i
        Me.Combo3.ListIndex = 0
        Me.Command3.Enabled = False
        sql = "select 编号 from judgeInformation"   '法官编号列表
        Set rs = TransactSQL(sql)
        If rs.EOF = False Then
            rs.MoveFirst
            While Not rs.EOF
                Me.Combo4.AddItem rs(0)
                rs.MoveNext
            Wend
            rs.Close
            Me.Combo4.ListIndex = 0
        End If
          sql1 = "select  编号 from lawyerInformation"   '律师编号列表
        Set rs = TransactSQL(sql1)
        If rs.EOF = False Then
            rs.MoveFirst
            While Not rs.EOF
                Me.Combo5.AddItem rs(0)
                rs.MoveNext
            Wend
            rs.Close
            Me.Combo5.ListIndex = 0
        End If
           If flag = 1 Then
                Me.Caption = "添加案件"
           Else
                Me.Caption = "修改案件信息"
                Me.Command2.Enabled = True
                Me.Command3.Enabled = True
                Call display
         End If
End Sub

Private Sub addNewRecord()
    Dim ndate As String
     Dim sql As String
    Dim rs As New ADODB.Recordset
    ndate = Trim(Me.Combo1) & "-" & Trim(Me.Combo2) & "-" & Trim(Me.Combo3)
    sql = "select * from caseInformation"
        Set rs = TransactSQL(sql)
        rs.AddNew                                 '添加新记录
            rs.Fields(0) = Trim(Me.Text1)
            rs.Fields(1) = Trim(Me.Text2)
            rs.Fields(2) = Trim(Me.Text3)
            rs.Fields(3) = Trim(Me.Text5)
            rs.Fields(4) = Trim(Me.Text4)
            rs.Fields(5) = ndate
            rs.Fields(6) = Trim(Me.Combo4.Text)
            rs.Fields(7) = Trim(Me.Combo5.Text)
                rs.Update
        rs.Close
End Sub
Private Sub init()
            Text1.Text = ""
            Text2.Text = ""
            Text3.Text = ""
            Text4.Text = ""
            Text5.Text = ""
End Sub

Public Sub display()
    Me.Text1.Enabled = False
    Me.Text1 = ingid.Fields(0)
    Me.Text2 = ingid.Fields(1)
    Me.Text3 = ingid.Fields(2)
    Me.Text5 = ingid.Fields(3)
    Me.Text4 = ingid.Fields(4)
    Me.Combo1 = Mid(ingid.Fields(5), 1, 4)
    Me.Combo2 = Mid(ingid.Fields(5), 6, 2)
    Me.Combo3 = Mid(ingid.Fields(5), 9, 2)
    Me.Combo4 = ingid.Fields(6)
    Me.Combo5 = ingid.Fields(7)
        Call Combo4_click
        Call Combo5_click
End Sub

Public Sub uprecord()
Dim ndate As String
  Dim sql, sql1, sql2 As String
    Dim rs As New ADODB.Recordset
     ndate = Trim(Me.Combo1) & "-" & Trim(Me.Combo2) & "-" & Trim(Me.Combo3)
      sql1 = "select * from caseInformation where 编号='" & Combo4.Text & "'"
        Set rs = TransactSQL(sql1)
        If rs.EOF = True Then
                MsgBox "法官编号错误！", vbOKOnly + vbExclamation, ""
            Else
                sql2 = "select * from caseInformation where 编号='" & Combo5.Text & "'"
                Set rs = TransactSQL(sql2)
             If rs.EOF = True Then
                MsgBox "律师编号错误！", vbOKOnly + vbExclamation, ""
            Else
                ingid.Fields(0) = Trim(Me.Text1)
                ingid.Fields(1) = Trim(Me.Text2)
                ingid.Fields(2) = Trim(Me.Text3)
                ingid.Fields(3) = Trim(Me.Text5)
                ingid.Fields(4) = Trim(Me.Text4)
                ingid.Fields(5) = ndate
                ingid.Fields(6) = Trim(Me.Combo4.Text)
                ingid.Fields(7) = Trim(Me.Combo5.Text)
                ingid.Update
                MsgBox "修改成功！", vbOKOnly + vbExclamation, "修改结果！"
                Unload Me
            End If
        End If
End Sub
