您的位置:程序门 -> 其他数据库开发 -> access



access不同界面自动单号问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


access不同界面自动单号问题[已结贴,结贴人:zhuzhiheng]
发表于:2007-09-11 22:47:06 楼主
wangtiecheng老师:如果在两个或三个不同界输入单号存储到一个表中,如:pj070911001   pj070911002       cp070911001   cp070911002         pg070911001     pg070911002     这样可分别在不同界面有序做自动单号吗?

这是以前一个界面的自动单号:
private   sub   form_load()
        me.流程单号   =   getbillnumber()
end   sub

public   function   getbillnumber()   as   string
        dim   s   as   string
       
        s   =   nz(dmax( "流程单号 ",   "表名 "),   " ")
       
        if   left(s,   8)   <>   format(date,   "yyyymmdd ")   or   s   =   " "   then
                s   =   format(date,   "yyyymmdd ")   &   "001 "
        else
                s   =   left(s,   8)   &   right( "000 "   &   val(right(s,   3))   +   1,   3)
        end   if
       
        getbillnumber   =   s
end   function
谢谢!
发表于:2007-09-11 22:49:031楼 得分:0
如果是两个界面那么单号前缀为两种啦,如hh   jj       如果是三个界面那么单号前缀就为三种啦,如hh   jj   kk
发表于:2007-09-11 23:02:412楼 得分:0
--改一下即可:


private   sub   form_load()
        me.流程单号   =   getbillnumber( "pj ")
end   sub

public   function   getbillnumber(strtype   as   string)   as   string
        dim   s   as   string
       
        s   =   nz(dmax( "流程单号 ",   "表名 ", "left(流程单号,2)= ' "   &   strtype     &   " ' "),   " ")
       
        if   left(s,   8)   <>   format(date,   "yyyymmdd ")   or   s   =   " "   then
                s   =   format(date,   "yyyymmdd ")   &   "001 "
        else
                s   =   left(s,   8)   &   right( "000 "   &   val(right(s,   3))   +   1,   3)
        end   if
       
        getbillnumber   =   s
end   function
发表于:2007-09-11 23:20:153楼 得分:20
private   sub   form_load()
        me.流程单号   =   getbillnumber( "pj ")
end   sub

public   function   getbillnumber(strtype   as   string)   as   string
        dim   s   as   string
       
        s   =   nz(dmax( "流程单号 ",   "表名 ", "left(流程单号,2)= ' "   &   strtype     &   " ' "),   " ")
       
        if   left(s,   8)   <>   strtype   &   format(date,   "yymmdd ")   or   s   =   " "   then
                s   =   strtype   &   format(date,   "yymmdd ")   &   "001 "
        else
                s   =   left(s,   8)   &   right( "000 "   &   val(right(s,   3))   +   1,   3)
        end   if
       
        getbillnumber   =   s
end   function


快速检索

最新资讯
热门点击