#22002/9/1 14:55:28
靠人不如靠已,经过自己的努力,终于完成了,把代码帖出来,别人也可以用,如果有不对的地方,高手可要指出啊!
sub subcode
dim startyear
dim startmon
dim startday
dim code
startyear = year(date)
startmon = month(date)
startday = day(date)
//code= <%=(rs_newcode.Fields.Item("form_id").value)%>
//code=Form1.goodsid.value
if startmon<10 then
startmon="0"&month(date)
end if
if startday<10 then
startday="0"&day(date)
end if
if startyear&startmon&startday<>left(<%=(rs_newcoder.Fields.Item("form_code").value)%>,8) then
code=001
else
code=int(mid(<%=(rs_newcoder.Fields.Item("form_code").value)%>,9,3))+1
end if
if len(int(mid(<%=(rs_newcoder.Fields.Item("form_code").value)%>,9,3))+1)=1 then
code="00"&cstr(code)
end if
if len(int(mid(<%=(rs_newcoder.Fields.Item("form_code").value)%>,9,3))+1)=2 then
code="0"&cstr(code)
end if
Form1.goods_code.value = startyear & startmon&startday&cstr(code)
end sub