Private Sub C插入_Click()
If C插入.Caption = "插入" Then
    C插入.Caption = "保存"
    C修改.Enabled = False
    C删除.Enabled = False
    C返回.Caption = "取消"
    Cell1.DoAppendRow 1
    CurrentRow = Cell1.Rows - 1
    Cell1.DoSetCellReadOnly 0, CurrentRow, False
    Cell1.DoSetCellTextMode 0, CurrentRow, 1
    Cell1.DoSetCellReadOnly 1, CurrentRow, True
    Cell1.DoSetCellReadOnly 2, CurrentRow, False
    Cell1.DoSetCellReadOnly 3, CurrentRow, False
    Cell1.DoSetCellReadOnly 4, CurrentRow, False
    Cell1.DoMoveToCell 0, CurrentRow
    Cell1.DoRedrawRange 0, CurrentRow, 4, CurrentRow
    
Else
    txtSQL = "insert into 系部信息表 values ('" & Trim(fGetCellString(0, CurrentRow, Cell1)) _
                                   & "', '" & Trim(fGetCellString(2, CurrentRow, Cell1)) _
                                   & "', '" & Trim(fGetCellString(3, CurrentRow, Cell1)) _
                                   & "', '" & Trim(fGetCellString(4, CurrentRow, Cell1)) & "')"
    Call ExecuteSQL(txtSQL, msg_Sql)
    If Left(msg_Sql, 4) = "查询错误" Then
        MsgBox "输入数据错误", vbCritical, "错误信息"
        Exit Sub
    End If
    
    Set objRs = ExecuteSQL("Select * From 学院信息表 where 编号= left('" & Trim(fGetCellString(0, CurrentRow, Cell1)) & "',2)", msg_Sql)
    If Not objRs.EOF Then Cell1.DoSetCellString 1, CurrentRow, Trim(objRs("简称"))
    Cell1.DoSetCellReadOnly 0, CurrentRow, True
    Cell1.DoSetCellReadOnly 1, CurrentRow, True
    Cell1.DoSetCellReadOnly 2, CurrentRow, True
    Cell1.DoSetCellReadOnly 3, CurrentRow, True
    Cell1.DoSetCellReadOnly 4, CurrentRow, True
    Cell1.DoRedrawRange 0, CurrentRow, 4, CurrentRow
    
    C插入.Caption = "插入"
    C修改.Enabled = True
    C删除.Enabled = True
    C返回.Caption = "返回"
End If

End Sub

