idx = CInt(max.Substring(2,3)) + 1 '获得最大编号的后三位顺序号,并加1
改成
idx = CInt(max.Substring(lb.Length,3)) + 1 '获得最大编号的后三位顺序号,并加1