|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Dim CNN As New ADODB.Connection
Dim RST As New ADODB.Recordset
Dim pthStr$, SQL$, XXX$, s$
Stpath = ThisWorkbook.Path & "\公司数据.mdb"
s = "YS" & Year(Now) & Format(Month(Now), "00") & Format(Day(Now), "00")
CNN.Open "Provider=Microsoft.Jet.Oledb.4.0;data Source=" & Stpath
SQL = "select top 1 运输清单号 from JHD where left(运输清单号,10)='" & s & "' order by 运输清单号 desc"
RST.Open SQL, CNN, adOpenStatic, adLockReadOnly
If RST.RecordCount < 1 Then
Range("I4").Value = "YS" & Year(Now) & Format(Month(Now), "00") & Format(Day(Now), "00") & "001"
Else
XXX = Format(Right(RST.Fields(0), 3) + 1, "000")
Range("I4").Value = s & XXX
End If
RST.Close
CNN.Close
Set RST = Nothing
Set CNN = Nothing
我需要将后三位用36进制自动增加,代码怎么写。
|
|