还是自动编号的问题,代码如下,后附图,求解~~~~~~
Select e.DataCol.Name '自动编号
Case "单位"
If e.DataRow.IsNull("单位") Then
e.DataRow("序号") = Nothing
Else
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(序号)","[_Identify] <> " & e.DataRow("_Identify")) '取得该类别的最大编号
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(0,3)) + 1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("序号") = Format(idx,"000")
End If
End Select