以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  自动编号问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=150660)

--  作者:gudao123456
--  发布时间:2020/6/4 9:05:00
--  自动编号问题
抄了帮助文档,修改了相应的列而已,但编译失败,提示:没有可访问的的“computer” 接受此数目访问,因此重载决策失败。
错误代码: max = e.DataTable.Compute("Max("zzsqbh")","gzxx = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) \'取得该类别的最大编号

代码如下:
 If e.DataRow.IsNull("gzxx") Then
            e.DataRow("zzsqbh") = Nothing
        Else
            Dim lb As String = e.DataRow("gzxx")
            If e.DataRow("zzsqbh").StartsWith(lb) = False \'如果单据编号前缀不符
                Dim max As String
                Dim idx As Integer
                max = e.DataTable.Compute("Max("zzsqbh")","gzxx = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) \'取得该类别的最大编号
                If max > "" Then \'如果存在最大编号
                    idx = CInt(max.Substring(2,3)) + 1 \'获得最大编号的后三位顺序号,并加1
                Else
                    idx = 1 \'否则顺序号等于1
                End If
                e.DataRow("zzsqbh") = lb & Format(idx,"000")
            End If
        End If
为何?谢谢!
补充:表的主键是 [_Identify] 在命令窗口执行:
 dim dr as datarow=current.current.datarow
dim lb as string=dr("gzxx")
msgbox( max ="gzxx = \'" & lb & "\' And [_Identify] <> " & dr("_Identify"))
显示是正常的
[此贴子已经被作者于2020/6/4 9:22:03编辑过]

--  作者:有点蓝
--  发布时间:2020/6/4 9:15:00
--  
max = e.DataTable.Compute("Max(zzsqbh)","gzxx = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) 

列名不需要双引号

--  作者:gudao123456
--  发布时间:2020/6/4 9:23:00
--  
谢谢!