蓝老师您好!我用下面的代码自动编号,序号不自动增加,请指导'序号自动编号
Select e.DataCol.Name
Case "分类", "分组"
If e.DataRow.IsNull("分类") OrElse e.DataRow.IsNull("分组") Then
e.DataRow("序号") = Nothing
Else
Dim bh As String = e.DataRow("分类") & e.DataRow("分组") '生成序号的前缀
If e.DataRow("序号").StartsWith(bh) = False Then'如果单据编号前缀不符
Dim max As String
Dim idx As Integer
Dim flt As String
flt = "序号 = '" & e.DataRow("分类") & "' And '" & e.DataRow("分组") & "' And [_Identify] <> " & e.DataRow("_Identify")
max = e.DataTable.Compute("Max(序号)", flt) '取得最大单据序号
If max > "" Then '如果存在最大编号
' idx = CInt(max.Substring(6, 2)) + 1 '获得最大编号的后2位顺序号,并加1
idx = CInt(max.Substring(max.length - 2)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("序号") = bh & Format(idx, "00")
End If
End If
End Select
flt = "序号 = '" & e.DataRow("分类") & "' And '" & e.DataRow("分组") & "' And [_Identify] <> " & e.DataRow("_Identify")改为
flt = "分类 = '" & e.DataRow("分类") & "' And 分组='" & e.DataRow("分组") & "' And [_Identify] <> " & e.DataRow("_Identify")
.NET Framework 版本:4.0.30319.36543
Foxtable 版本:2022.8.18.1
错误所在事件:表,双代码自动编号,DataColChanged
详细错误信息:
Exception has been thrown by the target of an invocation.
Syntax error: Missing operand after 'And 分组' operator.
别人给的代码尽量直接复制。手输的要注意全角和半角的区别,【
And 分组】之间是半角的空格,不是全角的空格