Else
SSTab1.TabEnabled(i) = bLock
End If
Next
End Sub
Private Sub cboht_Click() '选合同
Dim sSQL As String
sSQL = "SELECT * FROM 项目信息 WHERE 合同编号='" & Format(cboht.ItemData(cboht.ListIndex), "0000") & "' ORDER BY 项目编号"
adoxm.RecordSource = sSQL '显示本客户本合同现有项目
adoxm.Refresh
End Sub
Private Sub cbokh1_Click() '选择客户组合框(合同选项卡)
Dim sSQL As String
sSQL = "SELECT * FROM 合同信息 WHERE 客户编号='" & Format(cbokh1.ItemData(cbokh1.ListIndex), "00") & "' ORDER BY 合同编号"
adoht.RecordSource = sSQL '显示现有合同
adoht.Refresh
End Sub
Private Sub cbokh2_Click() '选择客户组合框(工程选项卡)
Dim skhbh As String
skhbh = Format(cbokh2.ItemData(cbokh2.ListIndex), "00") '客户编号
Call AddxmItem(cboht, skhbh) '填充"合同"组合框
cboht.Enabled = True
If cboht.ListIndex = -1 Then '若本客户无合同
fraCmdBtn.Enabled = False
adoxm.RecordSource = "SELECT * FROM 项目信息 WHERE 合同编号='"
adoxm.Refresh
Else
fraCmdBtn.Enabled = True
End If
End Sub
Private Sub cmdAdd_Click() '添加
Dim sID As String
Call MyLock(False, SSTab1.Tab)
If SSTab1.Tab = 0 Then '添加客户
With adokh.Recordset '自动生成客户编号
If .RecordCount > 0 Then
.MoveLast
sID = Format(Val(.Fields("客户编号").Value) + 1, "00")
Else
sID = "01"
End If
.AddNew
.Fields("客户编号").Value = sID
End With
txtkhxm.SetFocus
ElseIf SSTab1.Tab = 1 Then '添加合同
With adoht.Recordset '自动生成专业号
If .RecordCount > 0 Then
.MoveLast
sID = .Fields("合同编号").Value
sID = Mid$(sID, 1, 2) & Format(Val(Right$(sID, 2)) + 1, "00") VB公司合同管理系统开发与设计(16):http://www.youerw.com/jisuanji/lunwen_4550.html