表达式列,不能作为关联列。
你把编号列改成数据列,然后用代码生成吧,DataRowAdding事件
Dim bh As String="KH"
Dim max As String
Dim idx As Integer
max = DataTables("表A").Compute("Max(第一列)","第一列 like '" & bh & "%'")
If max > "" Then '如果存在最大销售单号
idx = CInt(max.Substring(bh.Length+1)) + 1 '获得最大销售单号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("第一列") = bh & Format(idx,"000")