For Each r As Row In Tables("销售意向客户进度管制")
If r.Isnull("客户名称") =True Then
MessageBox.Show("客户名称未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
Return
Exit For
End If
If r.Isnull("意向级别") =True Then
MessageBox.Show("意向级别未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
Return
Exit For
End If
If r.Isnull("建档日期") =True Then
MessageBox.Show("建档日期未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
Return
Exit For
End If
If r.Isnull("最后联系日期") =True Then
MessageBox.Show("最后联系日期未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
Return
Exit For
End If
If r.Isnull("最后一次回访情况") =True Then
MessageBox.Show("最后一次回访情况未填写", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
Return
Exit For
End If
For Each cl As Row In Tables("销售意向客户进度管制")
If user.group = "销售部"
If cl("业务员申请")= "驳回 修改申请" Or cl("业务员申请")= "驳回 删除申请" Or cl("业务员申请")= "驳回 战败申请" Or cl("业务员申请")= "驳回 战胜申请" Or cl("业务员申请")= "驳回 修改申请" Or cl("业务员申请")= "批准修改" Or cl("业务员申请")= "批准删除" Or cl("业务员申请")= "批准战胜" Or cl("业务员申请")= "批准战败" Then
cl("业务员申请") =""
End If
End If
Next
If user.group <> "客服部" Then
Dim f As New Filler
f.SourceTable = DataTables("销售意向客户进度管制") '指定数据来源
f.SourceCols = "编号,意向级别,最后联系日期,最后一次回访情况,备注" '指定数据来源列
f.DataTable = DataTables("意向客户历史回访情况") '指定数据接收表
f.DataCols = "编号,意向级别,最后联系日期,最后一次回访情况,备注" '指定数据接收列
f.ExcludeExistValue =True
f.ExcludeNullValue =False
f.Distinct =True
f.Append =True
f.Fill()
End If
If user.group <> "客服部" Then
DataTables("销售意向客户进度管制") .DeleteFor("[客户名称] Is Null and [联系地址] Is Null and [联系号码] Is Null And [欲购车型] Is Null and [意向级别] Is Null and [建档日期] Is Null and [最后联系日期] Is Null and [下次回访日期] Is Null and [最后一次回访情况] Is Null and [备注] Is Null and [客户来源] Is Null and [业务员申请] Is Null")
End If
If user.group <> "客服部" Then
For Each dt As DataTable In DataTables
For Each cl As Row In Tables("销售意向客户进度管制")
If user.name <> "销售经理" AndAlso user.name <> "开发者"
cl("客户资料锁定") = True
End If
Next
dt.save()
Next
End If
Next
怎么精简这段代码 我估计 是for each 运用太多导致
[此贴子已经被作者于2011-9-27 22:16:27编辑过]