Getting NULL Values--Any HELP

Form contains a computedtext which get seq num, but suddenly if i create new doc it is getting seq num as NULL. I tried all the options but only which i found is if i delete all the null contain doc new doc is getting next genaration num but i dont want to delete the doc becoz there are huge no of null docs now. Any Idea how to solve this prob

Function SeqNumGeneration(SearchKey As String, DocType As String)As String

On Error Goto errorhand

Dim ses As New NotesSession

Dim db As NotesDatabase

Dim SeqVw As NotesView

Dim vwEntry As NotesViewEntry

Dim seqDoc As NotesDocument

Set db = ses.CurrentDatabase

If DocType = “Procedure” Then

Set SeqVw = db.GetView(“SeqNumProc”)

End If

If DocType = “Policy” Then

Set SeqVw = db.GetView(“SeqNumPolc”)

End If

Call SeqVw.Refresh

If Not(SeqVw Is Nothing) Then

Set vwEntry = SeqVw.GetEntryByKey(SearchKey)

If Not(vwEntry Is Nothing) Then

Set seqDoc = vwEntry.Document

If Not(seqDoc Is Nothing) Then

'Here i am getting strSeqNum “NULL” so the new doc seq no is going to be null

strSeqNum = seqDoc.SeqNum(0)

'If Len(Trim(strSeqNum)) = 0 Then

'strSeqNum = “NULL”

'Msgbox strSeqNum

'Else

strSeqNum = Cint(strSeqNum) + 1

'End If

End If

Else

End If

End If

Exit Function

errorhand:

Msgbox "Error in SeqNumGeneration ==>> " + Error$ + " at line number " + Cstr(Erl) + "; Error Code : " + Cstr(Err)

Print "Error in SeqNumGeneration ==>> " + Error$ + " at line number " + Cstr(Erl) + "; Error Code : " + Cstr(Err)

Exit Function

End Function

Subject: Getting NULL Values–Any HELP

I’ve never used the notesEntry class, is there a particular reason you’re using it? (Curious)

Here is how my version of your code would look. What happens with this? There are a couple of cases you don’t seem to catch and I’m wondering if that’s the problem.

Function SeqNumGeneration(SearchKey As String, DocType As String)As String

. . On Error Goto errorhand

. . Dim ses As New NotesSession

. . Dim db As NotesDatabase

. . Dim SeqVw As NotesView

. . Dim vwEntry As NotesViewEntry

. . Dim seqDoc As NotesDocument

. . Set db = ses.CurrentDatabase

. .

. . If DocType = “Procedure” Then

. . . . Set SeqVw = db.GetView(“SeqNumProc”). . . .

. . elseif DocType = “Policy” Then

. . . . Set SeqVw = db.GetView(“SeqNumPolc”). . . .

. . else

. . . . ’ unexpect request

. . End If

. . Call SeqVw.Refresh

. . If Not(SeqVw Is Nothing) Then

’ REMOVE Set vwEntry = SeqVw.GetEntryByKey(SearchKey)

. . . . Set seqDoc = SeqVw.GetDocumentByKey( SearchKey, True )

. . . . If Not(seqDoc Is Nothing) Then

. . . . . . strSeqNum = seqDoc.SeqNum(0)

. . . . . . strSeqNum = Cint(strSeqNum) + 1

. . . . else

. . . . . . ’ What should strSeqNum be if value is not found?

. . . . End If

. . Else

. . . . ’ No View found

. . End If

. .

. . Exit Function

errorhand:

. . Msgbox "Error in SeqNumGeneration ==>> " + Error$ + " at line number " + Cstr(Erl) + "; Error Code : " + Cstr(Err)

. . Print "Error in SeqNumGeneration ==>> " + Error$ + " at line number " + Cstr(Erl) + "; Error Code : " + Cstr(Err)

. . Exit Function

End Function

Subject: RE: Getting NULL Values–Any HELP

Let me explain, i have few doc in the view “SeqNumProc” doc contain field to set up seqnum.Intially i have created few docs and got seq num like(docno.1,docno.2 etc) with out any errors. But suddenly i got new doc seqnum like (docno.NULL) later on i am getting the same seqnum(docno.NULL) for every new doc.

if i check the code "strSeqNum = seqDoc.SeqNum(0)

" here i am getting NULL so it can’t calc “strSeqNum = Cint(strSeqNum) + 1” then it goes to error hand displays error and create doc seqnum with docno.null

Any Help would be appreciated.

Subject: RE: Getting NULL Values–Any HELP

Thanks for your time, if it is possible could you please modify my code and send me your version let me try that.

Subject: RE: Getting NULL Values–Any HELP

I did. The code posted is my version.