Function GetFormNo() As Long
' 得到申购单号
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim cur_no As Variant
Dim i As Integer
Dim FormNo As Long
Set db = session.CurrentDatabase
Set view = db.GetView("byformno")
Set doc = view. GetDocumentByKey("fmno")
If doc Is Nothing Then
Messagebox "申购编号文档不存在,请与管理员联系!"
Exit Function
End If
For i = 1 To 20 ' 该段程序经过测试能够处理后台并发访问 2000-08-29
cur_no = Doc.GetItemValue( "applyform_no" )
formno=cur_no(0)+1
doc.applyform_no=formno
If doc.save(False,False) Then Exit For
If i = 20 Then
Messagebox "网络拥塞,请与服务器或网络管理员联系!"
Exit Function
End If
Delete Doc ' 该语句是为了感觉上的安全放在这里
Print "retry:" , Now
Set Doc = view. GetDocumentByKey("fmno")
Next
getformno=formno
End Function