在access中把自定义自动编号的控件的默认值设置为
=Left(Format(Format(Date(),'yyyymmdd'))+Format(DCount("ID","表1","时间 = date()")+1),8) & Choose(12-Len(Format(Format(Date(),'yyyymmdd'))+Format(DCount("ID","表1","时间 = date()")+1)),"0","00","000") & Right(Format(Format(Date(),'yyyymmdd'))+Format(DCount("ID","表1","时间 = date()")+1),(Len(Format(Format(Date(),'yyyymmdd'))+Format(DCount("ID","表1","时间 = date()")+1))-8))
呵呵,代码是长了些,有没有高手简化一下
你的那个太麻烦了。直接用
Format(Date(),'yyyymmdd')+Format(DCount("ID","表1","时间 = date()")+1,"0000")
就行了