If e.sender.Value = Nothing Then
e.Form.Controls("textbox1").text = Nothing
Else
Dim bh As String = Format(e.sender.Value,"yyyyMMdd") \'取得编号的8位前缀
Dim max As String
Dim idx As Integer
max = DataTables("").Compute("Max(资金申请编号)","业务日期 = #" & e.sender.Value & "# ") \'取得该天的最大编号
If max > "" Then \'如果存在最大编号
idx = CInt(max.Substring(9,3)) + 1 \'获得最大编号的后三位顺序号,并加1
Else
idx = 1 \'否则顺序号等于1
End If
e.Form.Controls("textbox1").text ="Z" & bh & Format(idx,"000")
End If