以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=24475)

--  作者:menglisharqf
--  发布时间:2012/10/15 13:11:00
--  [求助]

请教在狐表的自动编号中怎么设置为带时间的编号呢?例如今天 201210150001  201210150002  201210150003


--  作者:kevin
--  发布时间:2012/10/15 13:36:00
--  

可以在

DataRowAdding

事件中:

 

Dim T1,T2 As String
T1 = "MQ" & Format(Date.today,"yyMMdd")
T2 = "[客户编码] like \'" & T1 & "*\'and "
T2 = T2 & "[_Identify] < " & e.DataRow("_Identify")
Dim dr As DataRow = e.DataTable.Find(T2,"_Identify DESC")

If dr Is Nothing Then
   e.DataRow("客户编码") = T1 & "0001"
Else
   Dim n As Integer = Cint(Right(dr("客户编码"),4))+1
   e.DataRow("客户编码") = T1 & Format(n,"0000")
End If


--  作者:lin_hailun
--  发布时间:2012/10/15 13:41:00
--  
 这种,用表达式无法完成,需要编写代码。

 参考 http://www.foxtable.com/help/topics/2403.htm