If e.DataCol.Name = "clxx_lphm" Then
If e.DataRow("clxx_lphm") > "" Then
e.DataRow("ajdjh") = Nothing
Else
Dim y As Integer = Date.Today.Year
Dim qz As String = Tables("jgbmwh").Rows(0)("bmqz")
Dim bh_temp As String = qz & "字[[]" & y & "[]]"
Dim bh As String = qz & "字[" & y & "]"
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(ajdjh)","ajdjh like '" & bh_temp & "%' And [_Identify] <> " & e.DataRow("_Identify"))
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(bh.Length, 5)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("ajdjh") = bh & Format(idx,"00000") & "号"
End If
End If
我在clxx_lphm单元格不为空时自动编号
这个代码错在哪里,请大侠指教,谢谢