VB公司合同管理系统开发与设计(17)_毕业论文

毕业论文移动版

毕业论文 > 计算机论文 >

VB公司合同管理系统开发与设计(17)


            Else
                sID = Format(cbokh1.ItemData(cbokh1.ListIndex), "00") & "01"
            End If
            .AddNew
            .Fields("合同编号").Value = sID
            .Fields("客户编号").Value = Mid$(sID, 1, 2)
        End With
        txthtmc.SetFocus
    ElseIf SSTab1.Tab = 2 Then    '添加项目
        With adoxm.Recordset  '自动生成项目编号
            If .RecordCount > 0 Then
                .MoveLast
                sID = .Fields("项目编号").Value
                sID = Mid$(sID, 1, 4) & Format(Val(Right$(sID, 2)) + 1, "00")
            Else
                sID = Format(cboht.ItemData(cboht.ListIndex), "00") & "01"
            End If
            .AddNew
            .Fields("项目编号").Value = sID
            .Fields("合同编号").Value = Mid$(sID, 1, 2)
        End With
        txtxmmc.SetFocus
    End If
End Sub

Private Sub cmdCancel_Click()
    On Error GoTo UpdateErr
    Dim varBookmark As Variant
    Dim adoTmp As Adodc  '利用对象变量处理ADO数据控件
    If SSTab1.Tab = 0 Then '客户
        Set adoTmp = adokh
    ElseIf SSTab1.Tab = 1 Then '合同
        Set adoTmp = adoht
    ElseIf SSTab1.Tab = 2 Then '项目
        Set adoTmp = adoxm
    End If
    varBookmark = adoTmp.Recordset.Bookmark   '存书签
    adoTmp.Recordset.CancelBatch
    adoTmp.Refresh
    adoTmp.Recordset.Bookmark = varBookmark   '指针返回原记录
    Call MyLock(True, SSTab1.Tab)
    Exit Sub
UpdateErr:
    If Err.Number <> -2147217906 Then MsgBox Err.Description '错误号为书签无效
    Call MyLock(True, SSTab1.Tab)
End Sub

Private Sub cmdDelete_Click()
    Dim iTb As Integer
    Dim sMsg As String
    iTb = SSTab1.Tab
    If iTb = 0 And adokh.Recordset.RecordCount = 0 Then Exit Sub
    If iTb = 1 And adoht.Recordset.RecordCount = 0 Then Exit Sub
    If iTb = 2 And adoxm.Recordset.RecordCount = 0 Then Exit Sub
    sMsg = "注意!" & vbCrLf & vbCrLf _ (责任编辑:qin)