Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Multi-valued GetItemValue and VBA

Multi-valued GetItemValue and VBA

From: Chris Brady <Use-Author-Address-Header_at_[127.1>
Date: Tue, 10 Apr 2001 15:15:33 -0700 (PDT)
Message-ID: <20010410221533.10537.qmail@web1304.mail.yahoo.com>

Please can someone advise;

I'm using an MS Access 8 module written in VBA to transfer data directly from fields in a Notes 4.5.7 database to an Oracle db. All works fine except for one thing - extracting all values from a Notes multi-value menu item.

The code for getting a single value of an item is:

itemval = NotesDoc.GetItemValue(fieldname)(0)

the zero indicating the first and usually only value in that item.

However to obtain other values from a multi-valued item, e.g. a menu list, it is necessary to loop round the 'array' collecting all the other values. In Lotus Script this is done with:

For Each fieldval In NotesDoc.GetItemValue(fieldname)

    itemval = itemval & "," & fieldval
Next

or something similar. But this doesn't work in VBA because VBA cannot directly cycle through all item values in a field.

The only solution I've found to stop the looping is to error trap a Subscript Out Of Range error, thus:

Function Get_Item_Values (notesDoc As Object, _

                arraysize As Integer) As String 
    For i = 0 To arraysize
        On Error GoTo EndLoop
        results = results & "," & _
            notesDoc.GetItemValue(fieldname)(i)
    Next i
EndLoop:

Get_Item_Values = Mid(results, 2, Len(results) - 1)

End Function  

Does anyone know any better method please?

Many thanks - Chris B.



Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ Received on Tue Apr 10 2001 - 17:15:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US