If e.DataCol.Name = "凭证类别" Then
Dim dr,dr1 As DataRow
Dim n As Integer
dr = e.DataRow
If dr.IsNull("凭证类别") Then
dr("凭证ID") = Nothing
Else
dr1 =e.DataTable.Find("[_Identify]< " & dr ("_Identify") & " And 凭证类别 = '" & dr("凭证类别") & "'","凭证ID Desc")
If dr1 IsNot Nothing Then
n = CInt(dr1("凭证ID").substring(2))+1
Else
n=1
End If
dr("凭证ID") =iif(dr("凭证类别") ="收款","SK","FK") & format(n,"0000")
End If
End If
[此贴子已经被作者于2011-6-21 19:02:41编辑过]