This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
~Dexter Minweburings 18.Dec.03 04:15 PM a Web browser Domino Designer6.0.3Windows 2000
Hello all,
I'm having a problem with a type mismatch and a number field. Below is a snippet of code where I am reaching back into a previously created document. The code has already found a document and has a letter code to identify which case it needs to go to. All cases work with the exception of case "C". Case C errors out with a type mismatch. It seems to not find the rtitem which is there and saved. And then it errors on [totalLetter= doc.totalC(0)] which doc.totalC is declared a number field and totalLetter is an integer. What I don't understand is that in the other cases if rtitemB is the one I'm looking for it can be seen in the Items list of doc in debug mode. If it is rtitemC then it sees rtitemA in the Items list and not C and rtitem is not set. Does this have anything to do with how getfirstitem works? I thought you could grab any rich text item on the form. Any help is much appreciated as I'm am stuck on this one.
doc.Form = "Person"
total = doc.total(0)
createdDay = Cstr(passeddoc.Created)
doc.total = total + 1
Select Case exception
Case "A": Set rtitem = doc.GetFirstItem("rtdoclinkA")
totalLetter = doc.totalA(0)
doc.totalA=totalLetter + 1
Case "B": Set rtitem = doc.GetItemValue("rtdoclinkB")
totalLetter= doc.totalB(0)
doc.totalB=totalLetter + 1
Case "C": Set rtitem = doc.GetFirstItem("rtdoclinkC")
totalLetter= doc.totalC(0)
doc.totalC=totalLetter + 1
Case "D":Set rtitem = doc.GetFirstItem("rtdoclinkD")
totalLetter= doc.totalD(0)
doc.totalD=totalLetter + 1
Case "E": Set rtitem = doc.GetFirstItem("rtdoclinkE")
totalLetter= doc.totalE(0)
doc.totalE=totalLetter + 1
Case Else: Goto noLetterCode
End Select
**********************************************
if you need a broader picture here is the complete function.
**********************************************
Function CreateDocument(Person As Variant,exception As Variant,passeddoc As notesdocument) As Integer
Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim doc As New notesdocument(db)
Dim view As NotesView
Dim savedrtitem As NotesRichTextItem
Dim totalLetter As Integer
Set view = db.GetView("Offenders")
person1=Trim(Person)
Set doc = view.GetDocumentByKey(person1)
If doc Is Nothing Then
Set doc = New NotesDocument ( db )
Dim rtitem As NotesRichTextItem
doc.Form = "Person"
doc.Store = Trim(Person)
doc.total = 1
Select Case exception
Case "A": Set rtitem = New NotesRichTextItem( doc, "rtdoclinkA" )
doc.totalA=1
Case "B": Set rtitem = New NotesRichTextItem( doc, "rtdoclinkB" )
doc.totalB=1
Case "C": Set rtitem = New NotesRichTextItem( doc, "rtdoclinkC" )
doc.totalC=1
Case "D": Set rtitem = New NotesRichTextItem( doc, "rtdoclinkD" )
doc.totalD=1
Case "E": Set rtitem = New NotesRichTextItem( doc, "rtdoclinkE" )
doc.totalE=1
Case Else: Goto noLetterCode
End Select
whatistoday = Cstr(Today())
Call rtitem.AppendText(Chr(13) + "Link to the Infraction Document from " + whatistoday+ Chr(9))
Call rtitem.AppendDocLink(passeddoc,"Infraction Document")
Call rtitem.AppendText(Chr(13) + "*****************************************************************")
Call doc.Save(True,False)
Else
doc.Form = "Person"
total = doc.total(0)
createdDay = Cstr(passeddoc.Created)
doc.total = total + 1
Select Case exception
Case "A": Set rtitem = doc.GetFirstItem("rtdoclinkA")
totalLetter = doc.totalA(0)
doc.totalA=totalLetter + 1
Case "B": Set rtitem = doc.GetItemValue("rtdoclinkB")
totalLetter= doc.totalB(0)
doc.totalB=totalLetter + 1
Case "C": Set rtitem = doc.GetFirstItem("rtdoclinkC")
totalLetter= doc.totalC(0)
doc.totalC=totalLetter + 1
Case "D":Set rtitem = doc.GetFirstItem("rtdoclinkD")
totalLetter= doc.totalD(0)
doc.totalD=totalLetter + 1
Case "E": Set rtitem = doc.GetFirstItem("rtdoclinkE")
totalLetter= doc.totalE(0)
doc.totalE=totalLetter + 1
Case Else: Goto noLetterCode
End Select
Call rtitem.AddNewLine( 1 )
'Set rtitem = New NotesRichTextItem( doc, "rtdoclink" )
Call rtitem.AppendText(Chr(13) + "New Link to the Infraction Document from " + createdDay+ Chr(9))
Call rtitem.AppendDocLink(passeddoc,"Infraction Document")
Call rtitem.AppendText(Chr(13) + "*****************************************************************")
Call doc.Save(True,False)
End If
noLetterCode:
CreateDocument = 1
End Function