|
Function AdNo() As String
Dim Rs As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Dim I As Integer
Set Conn = CurrentProject.Connection
Rs.Open "select count(*) from co where mid(coNO,4,6)=format(date(),'yymmdd')", Conn, adOpenDynamic, adLockOptimistic
If Rs.EOF Then
I = 1
Else
I = Rs.Fields(0) + 1
End If
AdNo = "RG" & Format(Date, "yymmdd") & "-" & "CS" & Format(I + 1, "000")
End Function
各位大大,上面代码不知道错在哪里,
我希望的是能实现日期自动变化,后面的CS号码是递增加1的形式,
即001,002,003,004等一路继续下去..
该如何修改后半节代码,
烦请指正.
谢谢
|
|