大家能帮看看这段代码吗?到底是什么问题呢?
我想实现不同地区的录入人员提交表单后,记录单号自动加1保存,形式如下:
如果是北京的人员就为:BJ0000001,BJ0000002......
如果是上海的人员就为:SH0000001,SH0000002......
我的代码能保存成0000001,0000002.....,怎么就加不上区域简称呀?
select case Session("Location")
case BJ
strCity="BJ"
case SH
strCity="SH"
end select
strMaxID="select Max(Record) from tblInfo where Location='"&Session("Location")&"'"
set MaxIDrs=conn.execute(strMaxID)
if isNULL(MaxIDrs(0)) then
MaxID="0000001"
else
tmpMaxID=clng(right(MaxIDrs(0),7))+1
select case len(tmpMaxID)
case 1
MaxID="000000" & tmpMaxID
case 2
MaxID="00000" & tmpMaxID
case 3
MaxID="0000" & tmpMaxID
case 4
MaxID="000" & tmpMaxID
case 5
MaxID="00" & tmpMaxID
case 6
MaxID="0" & tmpMaxID
case 7
MaxID=tmpMaxID
end select
end if
Session("MaxID")= strCity & MaxID