设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 3226|回复: 2
打印 上一主题 下一主题

[表] 如何access2007字段默认值如何编写可将自动编号格式为:KT1404自动编号

[复制链接]
1#
发表于 2014-4-15 00:49:58 | 显示全部楼层

回帖奖励 +3 点金钱

本帖最后由 易青城 于 2014-4-15 00:50 编辑

。。。

     Set MySet = dbs.OpenRecordset("SELECT COUNT(*) FROM [表] where Left([编号],6)='" & "KT" + Format(Right(Year(Date), 2), "00") + Format(Month(Date), "00") & "';")
     If MySet(0) = 0 Then
         
          编号 = "KT" + Format(Right(Year(Date), 2), "00") + Format(Month(Date), "00") + "01"
     
      Else
         
         Set MySet = dbs.OpenRecordset("SELECT max(val(right([编号],6))) FROM [表] where Left([编号],8)='" & "KT" + Format(Right(Year(Date), 2), "00") + Format(Month(Date), "00") & "';")
     
         编号 = "KT" + Format(Right(Year(Date), 2), "00") + Format(Month(Date), "00") + Format(Right(MySet(0), 2) + 1, "00")
        
     End If
   
         Set MySet = Nothing
。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-21 15:36 , Processed in 0.100418 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表