Select Case e.DataCol.Name Case "第一列", "第二列", "第三列" Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(第五列)"," 第一列 = '" & e.DataRow("第一列") & "' and 第二列 = '" & e.DataRow("第二列") & "' and 第三列 = '" & e.DataRow("第三列") & "' and [_Identify] <> " & e.DataRow("_Identify")) If max > "" Then '如果存在最大编号 idx = CInt(max.Substring(0,3)) + 1 '获得最大编号的后三位顺序号,并加1 e.DataRow("第五列") = Format(idx,"000")