有这样一个格式的编号,请问各位版主如何自动产生.LD06PE0575.
其中LD和PE是固定的,06是年份,0575是流水号,也就是说顺序下排0576,0577等等.
就是说双击后可以自动按前面的流水号自己产生,比如第一个是LD06PE0575.第二个就是LD06PE0576.
各位谢谢了,在此拜托了.
我的写法是,但是不对.ORDERNO是字段名,O-外贸订货单头是表名.
Dim cn1 As New ADODB.Connection
Dim com As New ADODB.Command
Dim rec1 As New ADODB.Recordset
Dim strtemp, a, b As String
DoCmd.GoToRecord , , acNewRec
Set cn1 = CurrentProject.Connection
Set com.ActiveConnection = cn1
com.CommandText = "select max(ORDERNO) as ORDERNO from [O-外贸订货单头]"
Set rec1 = com.Execute
strtemp = rec1("ORDERNO")
strtemp = 'LD' + Right(Year(DATE), 2) +'PE'+ Right((Right(strtemp, 4) + 1), 4)
Me.OrderNo = strtemp
[此贴子已经被作者于2006-8-24 7:37:42编辑过]
|