variant does not contain an object

  • ich bekomme die fehlermeldung in einem Lotusscript.


    was kann das sein? ich komme nicht so ganz klar mit dem debugger. Muss ich noch initialisierungen vornehmen?
    wenn ja, welche?


    das script lautet folgendermassen:


    Sub Click(Source As Button)

    REM if the first approvers are done then send to first second approver
    REM Call doc.ComputeWithForm(False, False)
    firstapprovers = doc.GetItemValue("FirstApprovalsPending")
    If firstapprovers(0) = "" And Ubound(firstapprovers) = 0 Then
    secondapprovers = doc.GetItemValue("SecondApprovalsPending")
    If secondapprovers(0) = "" And Ubound(secondapprovers) = 0 Then
    REM Wenn der letzte secondapprover genehmigt hat, dann kein Zugriff mehr!

    doc.AllowedAuthors = "[AllAccess]"
    End If
    End If
    Call doc.Save(True, False)
    Call doc.Close
    End Sub

  • Hi pegasus,


    also wenn das das komplette script ist fehlt dir jedenfalls das init von doc.


    also zB


    dim uiw as new notesuiworkspace
    dim uidoc as notesuidocument
    set uidoc=uiw.currentdocument


    dim doc as notesdocument
    set doc=uidoc.document


    gleich hinter der sub click ... zeile einfügen


    ====


    zu guter letzt noch eine anmerkung:
    mit deiner abfrage ubound=0 läufst du ggf. auf das problem wenn das feld drei elemente hat die alle leer sind (zB enter, enter oder komma, komma) - wenn sicher ist, daß das feld getrimmed wird vor button click, dann brauchst du das natürlich nicht befürchten



    hoffe das hilft,


    vlg,
    - Florian
    ICODEX Software AG :: the developers of the one state-of-the-art Lotus Notes client management solution INTEGRATE!People

    - Florian (Vogler)
    ICODEX Software AG :: the developers of the one state-of-the-art Lotus Notes client management solution INTEGRATE!People......

  • jetzt kommt aber leider ILLEGAL USE OF PROPERTY


    mein code lautet jetzt:


    Sub Click(Source As Button)

    Dim uiw As New notesuiworkspace
    Dim uidoc As notesuidocument
    Set uidoc=uiw.currentdocument
    Dim doc As notesdocument

    Set doc=uidoc.document

    REM Set doc = ws.CurrentDocument.Document
    REM if the first approvers are done then send to first second approver
    REM Call doc.ComputeWithForm(False, False)
    firstapprovers = doc.GetItemValue("FirstApprovalsPending")
    If firstapprovers(0) = "" And Ubound(firstapprovers) = 0 Then
    secondapprovers = doc.GetItemValue("SecondApprovalsPending")
    If secondapprovers(0) = "" And Ubound(secondapprovers) = 0 Then
    REM Wenn der letzte secondapprover genehmigt hat, dann kein Zugriff mehr!

    doc.AllowedAuthors = "[AllAccess]"
    End If
    End If
    Call doc.Save(True, False)
    Call doc.Close
    End Sub

  • Schon mal im Debugger probiert? Welche Zeile kommt der Fehler
    Könnte sein dass firstapprovers kein Array ist? z.B. weill doc.FirstApprovalsPending leer ist. evtl. über die Notesitems gehen.

  • versuch das mal:



    Dim uiw As New notesuiworkspace
    Dim uidoc As notesuidocument
    Set uidoc=uiw.currentdocument
    Dim doc As notesdocument


    Dim fistapprovers as variant
    Dim secondapprovers as variant



    Set doc=uidoc.document


    firstapprovers = doc.getfirstitem("FirstApprovalsPending").values


    If not isarray(fistapprovers) Then
    secondapprovers =doc.GetfirstItem("SecondApprovalsPending").vlaues
    If not isarray(secondapprovers) Then





    es ist immer ein eiertanz bei mehrfachen feldinhalten.. es empfiehlt sich daher, immer auf arrays abzuprüfen bevor man auf den feldinhalt zugreift

    ----------------------------------------------------------------------------
    CLP R5 AD
    CLP R6 AD
    ...more to come...
    ----------------------------------------------------------------------------...